home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / g++-dist / expr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-02-11  |  173.9 KB  |  5,736 lines

  1. /* Convert tree expression to rtl instructions, for GNU compiler.
  2.    Copyright (C) 1988 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 1, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. #include "config.h"
  22. #include "rtl.h"
  23. #include "tree.h"
  24. #include "flags.h"
  25. #include "insn-flags.h"
  26. #include "insn-codes.h"
  27. #include "expr.h"
  28. #include "insn-config.h"
  29. #include "recog.h"
  30. #include "gvarargs.h"
  31. #include "typeclass.h"
  32.  
  33. /* Decide whether a function's arguments should be processed
  34.    from first to last or from last to first.  */
  35.  
  36. #ifdef STACK_GROWS_DOWNWARD
  37. #ifdef PUSH_ROUNDING
  38. #define PUSH_ARGS_REVERSED    /* If it's last to first */
  39. #endif
  40. #endif
  41.  
  42. /* Like STACK_BOUNDARY but in units of bytes, not bits.  */
  43. #define STACK_BYTES (STACK_BOUNDARY / BITS_PER_UNIT)
  44.  
  45. /* If this is nonzero, we do not bother generating VOLATILE
  46.    around volatile memory references, and we are willing to
  47.    output indirect addresses.  If cse is to follow, we reject
  48.    indirect addresses so a useful potential cse is generated;
  49.    if it is used only once, instruction combination will produce
  50.    the same indirect address eventually.  */
  51. int cse_not_expected;
  52.  
  53. /* Nonzero to generate code for all the subroutines within an
  54.    expression before generating the upper levels of the expression.
  55.    Nowadays this is never zero.  */
  56. int do_preexpand_calls = 1;
  57.  
  58. /* Number of units that we should eventually pop off the stack.
  59.    These are the arguments to function calls that have already returned.  */
  60. int pending_stack_adjust;
  61.  
  62. /* Nonzero means stack pops must not be deferred, and deferred stack
  63.    pops must not be output.  It is nonzero inside a function call,
  64.    inside a conditional expression, inside a statement expression,
  65.    and in other cases as well.  */
  66. int inhibit_defer_pop;
  67.  
  68. /* A list of all cleanups which belong to the arguments of
  69.    function calls being expanded by expand_call.  */
  70. static tree cleanups_this_call;
  71.  
  72. /* Nonzero means current function may call alloca
  73.    as a subroutine.  (__builtin_alloca does not count.)  */
  74. int may_call_alloca;
  75.  
  76. rtx store_expr ();
  77. static void store_constructor ();
  78. static rtx store_field ();
  79. static rtx expand_call ();
  80. static void emit_call_1 ();
  81. static rtx prepare_call_address ();
  82. static rtx expand_builtin ();
  83. static rtx compare ();
  84. static rtx compare_constants ();
  85. static rtx compare1 ();
  86. static rtx do_store_flag ();
  87. static void preexpand_calls ();
  88. static rtx expand_increment ();
  89. static void init_queue ();
  90.  
  91. void do_pending_stack_adjust ();
  92.  
  93. /* MOVE_RATIO is the number of move instructions that is better than
  94.    a block move.  */
  95.  
  96. #ifndef MOVE_RATIO
  97. #if defined (HAVE_movstrqi) || defined (HAVE_movstrhi) || defined (HAVE_movstrsi)
  98. #define MOVE_RATIO 2
  99. #else
  100. /* A value of around 6 would minimize code size; infinity would minimize
  101.    execution time.  */
  102. #define MOVE_RATIO 15
  103. #endif
  104. #endif
  105.  
  106. /* Table indexed by tree code giving 1 if the code is for a
  107.    comparison operation, or anything that is most easily
  108.    computed with a conditional branch.
  109.  
  110.    We include tree.def to give it the proper length.
  111.    The contents thus created are irrelevant.
  112.    The real contents are initialized in init_comparisons.  */
  113.  
  114. #define DEFTREECODE(SYM, NAME, TYPE, LENGTH) 0,
  115.  
  116. static char comparison_code[] = {
  117. #include "tree.def"
  118. };
  119. #undef DEFTREECODE
  120.  
  121. /* This is run once per compilation.  */
  122.  
  123. void
  124. init_comparisons ()
  125. {
  126.   comparison_code[(int) EQ_EXPR] = 1;
  127.   comparison_code[(int) NE_EXPR] = 1;
  128.   comparison_code[(int) LT_EXPR] = 1;
  129.   comparison_code[(int) GT_EXPR] = 1;
  130.   comparison_code[(int) LE_EXPR] = 1;
  131.   comparison_code[(int) GE_EXPR] = 1;
  132. }
  133.  
  134. /* This is run at the start of compiling a function.  */
  135.  
  136. void
  137. init_expr ()
  138. {
  139.   init_queue ();
  140.   may_call_alloca = 0;
  141. }
  142.  
  143. /* Manage the queue of increment instructions to be output
  144.    for POSTINCREMENT_EXPR expressions, etc.  */
  145.  
  146. static rtx pending_chain;
  147.  
  148. /* Queue up to increment (or change) VAR later.  BODY says how:
  149.    BODY should be the same thing you would pass to emit_insn
  150.    to increment right away.  It will go to emit_insn later on.
  151.  
  152.    The value is a QUEUED expression to be used in place of VAR
  153.    where you want to guarantee the pre-incrementation value of VAR.  */
  154.  
  155. static rtx
  156. enqueue_insn (var, body)
  157.      rtx var, body;
  158. {
  159.   pending_chain = gen_rtx (QUEUED, GET_MODE (var),
  160.                var, 0, 0, body, pending_chain);
  161.   return pending_chain;
  162. }
  163.  
  164. /* Use protect_from_queue to convert a QUEUED expression
  165.    into something that you can put immediately into an instruction.
  166.    If the queued incrementation has not happened yet,
  167.    protect_from_queue returns the variable itself.
  168.    If the incrementation has happened, protect_from_queue returns a temp
  169.    that contains a copy of the old value of the variable.
  170.  
  171.    Any time an rtx which might possibly be a QUEUED is to be put
  172.    into an instruction, it must be passed through protect_from_queue first.
  173.    QUEUED expressions are not meaningful in instructions.
  174.  
  175.    Do not pass a value through protect_from_queue and then hold
  176.    on to it for a while before putting it in an instruction!
  177.    If the queue is flushed in between, incorrect code will result.  */
  178.  
  179. rtx
  180. protect_from_queue (x, modify)
  181.      register rtx x;
  182.      int modify;
  183. {
  184.   register RTX_CODE code = GET_CODE (x);
  185.   if (code != QUEUED)
  186.     {
  187.       /* A special hack for read access to (MEM (QUEUED ...))
  188.      to facilitate use of autoincrement.
  189.      Make a copy of the contents of the memory location
  190.      rather than a copy of the address, but not
  191.      if the value is of mode BLKmode.  */
  192.       if (code == MEM && GET_MODE (x) != BLKmode
  193.       && GET_CODE (XEXP (x, 0)) == QUEUED && !modify)
  194.     {
  195.       register rtx y = XEXP (x, 0);
  196.       XEXP (x, 0) = QUEUED_VAR (y);
  197.       if (QUEUED_INSN (y))
  198.         {
  199.           register rtx temp = gen_reg_rtx (GET_MODE (x));
  200.           emit_insn_before (gen_move_insn (temp, x),
  201.                 QUEUED_INSN (y));
  202.           return temp;
  203.         }
  204.       return x;
  205.     }
  206.       /* Otherwise, recursively protect the subexpressions of all
  207.      the kinds of rtx's that can contain a QUEUED.  */
  208.       if (code == MEM)
  209.     XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  210.       else if (code == PLUS || code == MULT)
  211.     {
  212.       XEXP (x, 0) = protect_from_queue (XEXP (x, 0), 0);
  213.       XEXP (x, 1) = protect_from_queue (XEXP (x, 1), 0);
  214.     }
  215.       return x;
  216.     }
  217.   /* If the increment has not happened, use the variable itself.  */
  218.   if (QUEUED_INSN (x) == 0)
  219.     return QUEUED_VAR (x);
  220.   /* If the increment has happened and a pre-increment copy exists,
  221.      use that copy.  */
  222.   if (QUEUED_COPY (x) != 0)
  223.     return QUEUED_COPY (x);
  224.   /* The increment has happened but we haven't set up a pre-increment copy.
  225.      Set one up now, and use it.  */
  226.   QUEUED_COPY (x) = gen_reg_rtx (GET_MODE (QUEUED_VAR (x)));
  227.   emit_insn_before (gen_move_insn (QUEUED_COPY (x), QUEUED_VAR (x)),
  228.             QUEUED_INSN (x));
  229.   return QUEUED_COPY (x);
  230. }
  231.  
  232. /* Return nonzero if X contains a QUEUED expression:
  233.    if it contains anything that will be altered by a queued increment.
  234.    We handle only combinations of MEM, PLUS, MINUS and MULT operators
  235.    since memory addresses generally contain only those.  */
  236.  
  237. static int
  238. queued_subexp_p (x)
  239.      rtx x;
  240. {
  241.   register enum rtx_code code = GET_CODE (x);
  242.   switch (code)
  243.     {
  244.     case QUEUED:
  245.       return 1;
  246.     case MEM:
  247.       return queued_subexp_p (XEXP (x, 0));
  248.     case MULT:
  249.     case PLUS:
  250.     case MINUS:
  251.       return queued_subexp_p (XEXP (x, 0))
  252.     || queued_subexp_p (XEXP (x, 1));
  253.     }
  254.   return 0;
  255. }
  256.  
  257. /* Perform all the pending incrementations.  */
  258.  
  259. void
  260. emit_queue ()
  261. {
  262.   register rtx p;
  263.   while (p = pending_chain)
  264.     {
  265.       QUEUED_INSN (p) = emit_insn (QUEUED_BODY (p));
  266.       pending_chain = QUEUED_NEXT (p);
  267.     }
  268. }
  269.  
  270. static void
  271. init_queue ()
  272. {
  273.   if (pending_chain)
  274.     abort ();
  275. }
  276.  
  277. /* Copy data from FROM to TO, where the machine modes are not the same.
  278.    Both modes may be integer, or both may be floating.
  279.    UNSIGNEDP should be nonzero if FROM is an unsigned type.
  280.    This causes zero-extension instead of sign-extension.  */
  281.  
  282. void
  283. convert_move (to, from, unsignedp)
  284.      register rtx to, from;
  285.      int unsignedp;
  286. {
  287.   enum machine_mode to_mode = GET_MODE (to);
  288.   enum machine_mode from_mode = GET_MODE (from);
  289.   int to_real = GET_MODE_CLASS (to_mode) == MODE_FLOAT;
  290.   int from_real = GET_MODE_CLASS (from_mode) == MODE_FLOAT;
  291.   int extending = (int) to_mode > (int) from_mode;
  292.  
  293.   to = protect_from_queue (to, 1);
  294.   from = protect_from_queue (from, 0);
  295.  
  296.   if (to_real != from_real)
  297.     abort ();
  298.  
  299.   if (to_mode == from_mode
  300.       || (from_mode == VOIDmode && CONSTANT_P (from)))
  301.     {
  302.       emit_move_insn (to, from);
  303.       return;
  304.     }
  305.  
  306.   if (to_real)
  307.     {
  308. #ifdef HAVE_extendsfdf2
  309.       if (HAVE_extendsfdf2 && extending)
  310.     {
  311.       emit_unop_insn (CODE_FOR_extendsfdf2, to, from, UNKNOWN);
  312.       return;
  313.     }
  314. #endif
  315. #ifdef HAVE_truncdfsf2
  316.       if (HAVE_truncdfsf2 && ! extending)
  317.     {
  318.       emit_unop_insn (CODE_FOR_truncdfsf2, to, from, UNKNOWN);
  319.       return;
  320.     }
  321. #endif
  322.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, (extending
  323.                               ? "__extendsfdf2"
  324.                               : "__truncdfsf2")), 0,
  325.              GET_MODE (to), 1,
  326.              from,  (extending ? SFmode : DFmode));
  327.       emit_move_insn (to, hard_libcall_value (GET_MODE (to)));
  328.       return;
  329.     }
  330.  
  331.   /* Now both modes are integers.  */
  332.  
  333.   if (to_mode == DImode)
  334.     {
  335.       if (unsignedp)
  336.     {
  337. #ifdef HAVE_zero_extendsidi2
  338.       if (HAVE_zero_extendsidi2 && from_mode == SImode)
  339.         emit_unop_insn (CODE_FOR_zero_extendsidi2, to, from, ZERO_EXTEND);
  340.       else
  341. #endif
  342. #ifdef HAVE_zero_extendhidi2
  343.       if (HAVE_zero_extendhidi2 && from_mode == HImode)
  344.         emit_unop_insn (CODE_FOR_zero_extendhidi2, to, from, ZERO_EXTEND);
  345.       else
  346. #endif
  347. #ifdef HAVE_zero_extendqidi2
  348.       if (HAVE_zero_extendqidi2 && from_mode == QImode)
  349.         emit_unop_insn (CODE_FOR_zero_extendqidi2, to, from, ZERO_EXTEND);
  350.       else
  351. #endif
  352. #ifdef HAVE_zero_extendsidi2
  353.       if (HAVE_zero_extendsidi2)
  354.         {
  355.           convert_move (gen_lowpart (SImode, to), from, unsignedp);
  356.           emit_unop_insn (CODE_FOR_zero_extendsidi2, to,
  357.                   gen_lowpart (SImode, to), ZERO_EXTEND);
  358.         }
  359.       else
  360. #endif
  361.         {
  362.           emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  363.           convert_move (gen_lowpart (SImode, to), from, unsignedp);
  364.           emit_clr_insn (gen_highpart (SImode, to));
  365.         }
  366.     }
  367. #ifdef HAVE_extendsidi2
  368.       else if (HAVE_extendsidi2 && from_mode == SImode)
  369.     emit_unop_insn (CODE_FOR_extendsidi2, to, from, SIGN_EXTEND);
  370. #endif
  371. #ifdef HAVE_extendhidi2
  372.       else if (HAVE_extendhidi2 && from_mode == HImode)
  373.     emit_unop_insn (CODE_FOR_extendhidi2, to, from, SIGN_EXTEND);
  374. #endif
  375. #ifdef HAVE_extendqidi2
  376.       else if (HAVE_extendqidi2 && from_mode == QImode)
  377.     emit_unop_insn (CODE_FOR_extendqidi2, to, from, SIGN_EXTEND);
  378. #endif
  379. #ifdef HAVE_extendsidi2
  380.       else if (HAVE_extendsidi2)
  381.     {
  382.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  383.       emit_unop_insn (CODE_FOR_extendsidi2, to,
  384.               gen_lowpart (SImode, to), SIGN_EXTEND);
  385.     }
  386. #endif
  387. #ifdef HAVE_slt
  388.       else if (HAVE_slt && insn_operand_mode[(int) CODE_FOR_slt][0] == SImode)
  389.     {
  390.       emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  391.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  392.       emit_insn (gen_slt (gen_highpart (SImode, to)));
  393.     }
  394. #endif
  395.       else
  396.     {
  397.       register rtx label = gen_label_rtx ();
  398.  
  399.       emit_insn (gen_rtx (CLOBBER, VOIDmode, to));
  400.       emit_clr_insn (gen_highpart (SImode, to));
  401.       convert_move (gen_lowpart (SImode, to), from, unsignedp);
  402.       emit_cmp_insn (gen_lowpart (SImode, to),
  403.              gen_rtx (CONST_INT, VOIDmode, 0),
  404.              0, 0, 0);
  405.       NO_DEFER_POP;
  406.       emit_jump_insn (gen_bge (label));
  407.       expand_unop (SImode, one_cmpl_optab,
  408.                gen_highpart (SImode, to), gen_highpart (SImode, to),
  409.                1);
  410.       emit_label (label);
  411.       OK_DEFER_POP;
  412.     }
  413.       return;
  414.     }
  415.  
  416.   if (from_mode == DImode)
  417.     {
  418.       convert_move (to, gen_lowpart (SImode, from), 0);
  419.       return;
  420.     }
  421.  
  422.   /* Now follow all the conversions between integers
  423.      no more than a word long.  */
  424.  
  425.   /* For truncation, usually we can just refer to FROM in a narrower mode.  */
  426.   if (GET_MODE_BITSIZE (to_mode) < GET_MODE_BITSIZE (from_mode)
  427.       && TRULY_NOOP_TRUNCATION (GET_MODE_BITSIZE (to_mode),
  428.                 GET_MODE_BITSIZE (from_mode))
  429.       && ((GET_CODE (from) == MEM
  430.        && ! MEM_VOLATILE_P (from)
  431.        && ! mode_dependent_address_p (XEXP (from, 0)))
  432.       || GET_CODE (from) == REG
  433.       || GET_CODE (from) == SUBREG))
  434.     {
  435.       emit_move_insn (to, gen_lowpart (to_mode, from));
  436.       return;
  437.     }
  438.  
  439.   if (to_mode == SImode && from_mode == HImode)
  440.     {
  441.       if (unsignedp)
  442.     {
  443. #ifdef HAVE_zero_extendhisi2
  444.       if (HAVE_zero_extendhisi2)
  445.         emit_unop_insn (CODE_FOR_zero_extendhisi2, to, from, ZERO_EXTEND);
  446.       else
  447. #endif
  448.         abort ();
  449.     }
  450.       else
  451.     {
  452. #ifdef HAVE_extendhisi2
  453.       if (HAVE_extendhisi2)
  454.         emit_unop_insn (CODE_FOR_extendhisi2, to, from, SIGN_EXTEND);
  455.       else
  456. #endif
  457.         abort ();
  458.     }
  459.       return;
  460.     }
  461.  
  462.   if (to_mode == SImode && from_mode == QImode)
  463.     {
  464.       if (unsignedp)
  465.     {
  466. #ifdef HAVE_zero_extendqisi2
  467.       if (HAVE_zero_extendqisi2)
  468.         {
  469.           emit_unop_insn (CODE_FOR_zero_extendqisi2, to, from, ZERO_EXTEND);
  470.           return;
  471.         }
  472. #endif
  473. #if defined (HAVE_zero_extendqihi2) && defined (HAVE_extendhisi2)
  474.       if (HAVE_zero_extendqihi2 && HAVE_extendhisi2)
  475.         {
  476.           register rtx temp = gen_reg_rtx (HImode);
  477.           emit_unop_insn (CODE_FOR_zero_extendqihi2, temp, from, ZERO_EXTEND);
  478.           emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
  479.           return;
  480.         }
  481. #endif
  482.     }
  483.       else
  484.     {
  485. #ifdef HAVE_extendqisi2
  486.       if (HAVE_extendqisi2)
  487.         {
  488.           emit_unop_insn (CODE_FOR_extendqisi2, to, from, SIGN_EXTEND);
  489.           return;
  490.         }
  491. #endif
  492. #if defined (HAVE_extendqihi2) && defined (HAVE_extendhisi2)
  493.       if (HAVE_extendqihi2 && HAVE_extendhisi2)
  494.         {
  495.           register rtx temp = gen_reg_rtx (HImode);
  496.           emit_unop_insn (CODE_FOR_extendqihi2, temp, from, SIGN_EXTEND);
  497.           emit_unop_insn (CODE_FOR_extendhisi2, to, temp, SIGN_EXTEND);
  498.           return;
  499.         }
  500. #endif
  501.     }
  502.       abort ();
  503.     }
  504.  
  505.   if (to_mode == HImode && from_mode == QImode)
  506.     {
  507.       if (unsignedp)
  508.     {
  509. #ifdef HAVE_zero_extendqihi2
  510.       if (HAVE_zero_extendqihi2)
  511.         {
  512.           emit_unop_insn (CODE_FOR_zero_extendqihi2, to, from, ZERO_EXTEND);
  513.           return;
  514.         }
  515. #endif
  516.     }
  517.       else
  518.     {
  519. #ifdef HAVE_extendqihi2
  520.       if (HAVE_extendqihi2)
  521.         {
  522.           emit_unop_insn (CODE_FOR_extendqihi2, to, from, SIGN_EXTEND);
  523.           return;
  524.         }
  525. #endif
  526.     }
  527.       abort ();
  528.     }
  529.  
  530. #if 0 /* This seems to be redundant with code 100 lines up.  */
  531.  
  532.   /* Now we are truncating an integer to a smaller one.
  533.      If the result is a temporary, we might as well just copy it,
  534.      since only the low-order part of the result needs to be valid
  535.      and it is valid with no change.  */
  536.  
  537.   if (GET_CODE (to) == REG)
  538.     {
  539.       if (GET_CODE (from) == REG)
  540.     {
  541.       emit_move_insn (to, gen_lowpart (GET_MODE (to), from));
  542.       return;
  543.     }
  544.       else if (GET_CODE (from) == SUBREG)
  545.     {
  546.       from = copy_rtx (from);
  547.       /* This is safe since FROM is not more than one word.  */
  548.       PUT_MODE (from, GET_MODE (to));
  549.       emit_move_insn (to, from);
  550.       return;
  551.     }
  552. #ifndef BYTES_BIG_ENDIAN
  553.       else if (GET_CODE (from) == MEM)
  554.     {
  555.       register rtx addr = XEXP (from, 0);
  556.       if (memory_address_p (GET_MODE (to), addr))
  557.         {
  558.           emit_move_insn (to, gen_rtx (MEM, GET_MODE (to), addr));
  559.           return;
  560.         }
  561.     }
  562. #endif /* not BYTES_BIG_ENDIAN */
  563.     }
  564. #endif /* 0 */
  565.  
  566.   if (from_mode == SImode && to_mode == HImode)
  567.     {
  568. #ifdef HAVE_truncsihi2
  569.       if (HAVE_truncsihi2)
  570.     {
  571.       emit_unop_insn (CODE_FOR_truncsihi2, to, from, UNKNOWN);
  572.       return;
  573.     }
  574. #endif
  575.       abort ();
  576.     }
  577.  
  578.   if (from_mode == SImode && to_mode == QImode)
  579.     {
  580. #ifdef HAVE_truncsiqi2
  581.       if (HAVE_truncsiqi2)
  582.     {
  583.       emit_unop_insn (CODE_FOR_truncsiqi2, to, from, UNKNOWN);
  584.       return;
  585.     }
  586. #endif
  587.       abort ();
  588.     }
  589.  
  590.   if (from_mode == HImode && to_mode == QImode)
  591.     {
  592. #ifdef HAVE_trunchiqi2
  593.       if (HAVE_trunchiqi2)
  594.     {
  595.       emit_unop_insn (CODE_FOR_trunchiqi2, to, from, UNKNOWN);
  596.       return;
  597.     }
  598. #endif
  599.       abort ();
  600.     }
  601.  
  602.   /* Mode combination is not recognized.  */
  603.   abort ();
  604. }
  605.  
  606. /* Return an rtx for a value that would result
  607.    from converting X to mode MODE.
  608.    Both X and MODE may be floating, or both integer.
  609.    UNSIGNEDP is nonzero if X is an unsigned value.
  610.    This can be done by referring to a part of X in place
  611.    or by copying to a new temporary with conversion.  */
  612.  
  613. rtx
  614. convert_to_mode (mode, x, unsignedp)
  615.      enum machine_mode mode;
  616.      rtx x;
  617.      int unsignedp;
  618. {
  619.   register rtx temp;
  620.   if (mode == GET_MODE (x))
  621.     return x;
  622.   if (integer_mode_p (mode)
  623.       && GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (x))
  624.       && ! (GET_CODE (x) == MEM && MEM_VOLATILE_P (x)))
  625.     return gen_lowpart (mode, x);
  626.   temp = gen_reg_rtx (mode);
  627.   convert_move (temp, x, unsignedp);
  628.   return temp;
  629. }
  630.  
  631. int
  632. integer_mode_p (mode)
  633.      enum machine_mode mode;
  634. {
  635.   return (int) mode > (int) VOIDmode && (int) mode <= (int) TImode;
  636. }
  637.  
  638. /* Generate several move instructions to copy LEN bytes
  639.    from block FROM to block TO.  (These are MEM rtx's with BLKmode).
  640.    The caller must pass FROM and TO
  641.     through protect_from_queue before calling.
  642.    ALIGN (in bytes) is maximum alignment we can assume.  */
  643.  
  644. struct move_by_pieces
  645. {
  646.   rtx to;
  647.   rtx to_addr;
  648.   int autinc_to;
  649.   int explicit_inc_to;
  650.   rtx from;
  651.   rtx from_addr;
  652.   int autinc_from;
  653.   int explicit_inc_from;
  654.   int len;
  655.   int offset;
  656.   int reverse;
  657. };
  658.  
  659. static void move_by_pieces_1 ();
  660. static int move_by_pieces_ninsns ();
  661.  
  662. static void
  663. move_by_pieces (to, from, len, align)
  664.      rtx to, from;
  665.      int len, align;
  666. {
  667.   struct move_by_pieces data;
  668.   rtx to_addr = XEXP (to, 0), from_addr = XEXP (from, 0);
  669.  
  670.   data.offset = 0;
  671.   data.to_addr = to_addr;
  672.   data.from_addr = from_addr;
  673.   data.to = to;
  674.   data.from = from;
  675.   data.autinc_to
  676.     = (GET_CODE (to_addr) == PRE_INC || GET_CODE (to_addr) == PRE_DEC
  677.        || GET_CODE (to_addr) == POST_INC || GET_CODE (to_addr) == POST_DEC);
  678.   data.autinc_from
  679.     = (GET_CODE (from_addr) == PRE_INC || GET_CODE (from_addr) == PRE_DEC
  680.        || GET_CODE (from_addr) == POST_INC
  681.        || GET_CODE (from_addr) == POST_DEC);
  682.  
  683.   data.explicit_inc_from = 0;
  684.   data.explicit_inc_to = 0;
  685.   data.reverse
  686.     = (GET_CODE (to_addr) == PRE_DEC || GET_CODE (to_addr) == POST_DEC);
  687.   if (data.reverse) data.offset = len;
  688.   data.len = len;
  689.  
  690.   /* If copying requires more than two move insns,
  691.      copy addresses to registers (to make displacements shorter)
  692.      and use post-increment if available.  */
  693.   if (!(data.autinc_from && data.autinc_to)
  694.       && move_by_pieces_ninsns (len, align) > 2)
  695.     {
  696. #ifdef HAVE_PRE_DECREMENT
  697.       if (data.reverse && ! data.autinc_from)
  698.     {
  699.       data.from_addr = copy_addr_to_reg (plus_constant (from_addr, len));
  700.       data.autinc_from = 1;
  701.       data.explicit_inc_from = -1;
  702.     }
  703. #endif
  704. #ifdef HAVE_POST_INCREMENT
  705.       if (! data.autinc_from)
  706.     {
  707.       data.from_addr = copy_addr_to_reg (from_addr);
  708.       data.autinc_from = 1;
  709.       data.explicit_inc_from = 1;
  710.     }
  711. #endif
  712.       if (!data.autinc_from && CONSTANT_P (from_addr))
  713.     data.from_addr = copy_addr_to_reg (from_addr);
  714. #ifdef HAVE_PRE_DECREMENT
  715.       if (data.reverse && ! data.autinc_to)
  716.     {
  717.       data.to_addr = copy_addr_to_reg (plus_constant (to_addr, len));
  718.       data.autinc_to = 1;
  719.       data.explicit_inc_to = -1;
  720.     }
  721. #endif
  722. #ifdef HAVE_POST_INCREMENT
  723.       if (! data.reverse && ! data.autinc_to)
  724.     {
  725.       data.to_addr = copy_addr_to_reg (to_addr);
  726.       data.autinc_to = 1;
  727.       data.explicit_inc_to = 1;
  728.     }
  729. #endif
  730.       if (!data.autinc_to && CONSTANT_P (to_addr))
  731.     data.to_addr = copy_addr_to_reg (to_addr);
  732.     }
  733.  
  734. #ifdef STRICT_ALIGNMENT
  735.   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  736.     align = MOVE_MAX;
  737. #else
  738.   align = MOVE_MAX;
  739. #endif
  740.  
  741. #ifdef HAVE_movti
  742.   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
  743.     move_by_pieces_1 (gen_movti, TImode, &data);
  744. #endif
  745. #ifdef HAVE_movdi
  746.   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
  747.     move_by_pieces_1 (gen_movdi, DImode, &data);
  748. #endif
  749. #ifdef HAVE_movsi
  750.   if (align >= GET_MODE_SIZE (SImode))
  751.     move_by_pieces_1 (gen_movsi, SImode, &data);
  752. #endif
  753. #ifdef HAVE_movhi
  754.   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
  755.     move_by_pieces_1 (gen_movhi, HImode, &data);
  756. #endif
  757. #ifdef HAVE_movqi
  758.   move_by_pieces_1 (gen_movqi, QImode, &data);
  759. #else
  760.   movqi instruction required in machine description
  761. #endif
  762. }
  763.  
  764. /* Return number of insns required to move L bytes by pieces.
  765.    ALIGN (in bytes) is maximum alignment we can assume.  */
  766.  
  767. static int
  768. move_by_pieces_ninsns (l, align)
  769.      unsigned int l;
  770.      int align;
  771. {
  772.   register int n_insns = 0;
  773.  
  774. #ifdef STRICT_ALIGNMENT
  775.   if (align > MOVE_MAX || align >= BIGGEST_ALIGNMENT / BITS_PER_UNIT)
  776.     align = MOVE_MAX;
  777. #else
  778.   align = MOVE_MAX;
  779. #endif
  780.  
  781. #ifdef HAVE_movti
  782.   if (HAVE_movti && align >= GET_MODE_SIZE (TImode))
  783.     n_insns += l / GET_MODE_SIZE (TImode), l %= GET_MODE_SIZE (TImode);
  784. #endif
  785. #ifdef HAVE_movdi
  786.   if (HAVE_movdi && align >= GET_MODE_SIZE (DImode))
  787.     n_insns += l / GET_MODE_SIZE (DImode), l %= GET_MODE_SIZE (DImode);
  788. #endif
  789. #ifdef HAVE_movsi
  790.   if (HAVE_movsi && align >= GET_MODE_SIZE (SImode))
  791.     n_insns += l / GET_MODE_SIZE (SImode), l %= GET_MODE_SIZE (SImode);
  792. #endif
  793. #ifdef HAVE_movhi
  794.   if (HAVE_movhi && align >= GET_MODE_SIZE (HImode))
  795.     n_insns += l / GET_MODE_SIZE (HImode), l %= GET_MODE_SIZE (HImode);
  796. #endif
  797.   n_insns += l;
  798.  
  799.   return n_insns;
  800. }
  801.  
  802. /* Subroutine of move_by_pieces.  Move as many bytes as appropriate
  803.    with move instructions for mode MODE.  GENFUN is the gen_... function
  804.    to make a move insn for that mode.  DATA has all the other info.  */
  805.  
  806. static void
  807. move_by_pieces_1 (genfun, mode, data)
  808.      rtx (*genfun) ();
  809.      enum machine_mode mode;
  810.      struct move_by_pieces *data;
  811. {
  812.   register int size = GET_MODE_SIZE (mode);
  813.   register rtx to1, from1;
  814.  
  815.   while (data->len >= size)
  816.     {
  817.       if (data->reverse) data->offset -= size;
  818.  
  819.       to1 = (data->autinc_to
  820.          ? gen_rtx (MEM, mode, data->to_addr)
  821.          : change_address (data->to, mode,
  822.                    plus_constant (data->to_addr, data->offset)));
  823.       from1 =
  824.     (data->autinc_from
  825.      ? gen_rtx (MEM, mode, data->from_addr)
  826.      : change_address (data->from, mode,
  827.                plus_constant (data->from_addr, data->offset)));
  828.  
  829. #ifdef HAVE_PRE_DECREMENT
  830.       if (data->explicit_inc_to < 0)
  831.     emit_insn (gen_sub2_insn (data->to_addr,
  832.                   gen_rtx (CONST_INT, VOIDmode, size)));
  833.       if (data->explicit_inc_from < 0)
  834.     emit_insn (gen_sub2_insn (data->from_addr,
  835.                   gen_rtx (CONST_INT, VOIDmode, size)));
  836. #endif
  837.  
  838.       emit_insn ((*genfun) (to1, from1));
  839. #ifdef HAVE_POST_INCREMENT
  840.       if (data->explicit_inc_to > 0)
  841.     emit_insn (gen_add2_insn (data->to_addr,
  842.                   gen_rtx (CONST_INT, VOIDmode, size)));
  843.       if (data->explicit_inc_from > 0)
  844.     emit_insn (gen_add2_insn (data->from_addr,
  845.                   gen_rtx (CONST_INT, VOIDmode, size)));
  846. #endif
  847.  
  848.       if (! data->reverse) data->offset += size;
  849.  
  850.       data->len -= size;
  851.     }
  852. }
  853.  
  854. /* Emit code to move a block Y to a block X.
  855.    This may be done with string-move instructions,
  856.    with multiple scalar move instructions, or with a library call.
  857.  
  858.    Both X and Y must be MEM rtx's (perhaps inside VOLATILE)
  859.    with mode BLKmode.
  860.    SIZE is an rtx that says how long they are.
  861.    ALIGN is the maximum alignment we can assume they have,
  862.    measured in bytes.  */
  863.  
  864. static void
  865. emit_block_move (x, y, size, align)
  866.      rtx x, y;
  867.      rtx size;
  868.      int align;
  869. {
  870.   if (GET_MODE (x) != BLKmode)
  871.     abort ();
  872.  
  873.   if (GET_MODE (y) != BLKmode)
  874.     abort ();
  875.  
  876.   x = protect_from_queue (x, 1);
  877.   y = protect_from_queue (y, 0);
  878.  
  879.   if (GET_CODE (x) != MEM)
  880.     abort ();
  881.   if (GET_CODE (y) != MEM)
  882.     abort ();
  883.   if (size == 0)
  884.     abort ();
  885.  
  886.   if (GET_CODE (size) == CONST_INT
  887.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  888.       < MOVE_RATIO))
  889.     move_by_pieces (x, y, INTVAL (size), align);
  890.   else
  891.     {
  892.       /* Try the most limited insn first, because there's no point
  893.      including more than one in the machine description unless
  894.      the more limited one has some advantage.  */
  895. #ifdef HAVE_movstrqi
  896.       if (HAVE_movstrqi
  897.       && GET_CODE (size) == CONST_INT
  898.       && ((unsigned) INTVAL (size)
  899.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  900.     {
  901.       emit_insn (gen_movstrqi (x, y, size,
  902.                    gen_rtx (CONST_INT, VOIDmode, align)));
  903.       return;
  904.     }
  905. #endif
  906. #ifdef HAVE_movstrhi
  907.       if (HAVE_movstrhi
  908.       && GET_CODE (size) == CONST_INT
  909.       && ((unsigned) INTVAL (size)
  910.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  911.     {
  912.       emit_insn (gen_movstrhi (x, y, size,
  913.                    gen_rtx (CONST_INT, VOIDmode, align)));
  914.       return;
  915.     }
  916. #endif
  917. #ifdef HAVE_movstrsi
  918.       if (HAVE_movstrsi)
  919.     {
  920.       emit_insn (gen_movstrsi (x, y, size,
  921.                    gen_rtx (CONST_INT, VOIDmode, align)));
  922.       return;
  923.     }
  924. #endif
  925.  
  926. #ifdef TARGET_MEM_FUNCTIONS
  927.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
  928.              VOIDmode, 3, XEXP (x, 0), Pmode,
  929.              XEXP (y, 0), Pmode,
  930.              size, Pmode);
  931. #else
  932.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
  933.              VOIDmode, 3, XEXP (y, 0), Pmode,
  934.              XEXP (x, 0), Pmode,
  935.              size, Pmode);
  936. #endif
  937.     }
  938. }
  939.  
  940. /* Copy all or part of a BLKmode value X into registers starting at REGNO.
  941.    The number of registers to be filled is NREGS.  */
  942.  
  943. void
  944. move_block_to_reg (regno, x, nregs)
  945.      int regno;
  946.      rtx x;
  947.      int nregs;
  948. {
  949.   int i;
  950.   if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
  951.     x = force_const_double_mem (x);
  952.   for (i = 0; i < nregs; i++)
  953.     {
  954.       if (GET_CODE (x) == REG)
  955.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  956.             gen_rtx (SUBREG, SImode, x, i));
  957.       else if (x == dconst0_rtx)
  958.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  959.             const0_rtx);
  960.       else
  961.     emit_move_insn (gen_rtx (REG, SImode, regno + i),
  962.             gen_rtx (MEM, SImode,
  963.                  memory_address (SImode,
  964.                          plus_constant (XEXP (x, 0),
  965.                                 i * GET_MODE_SIZE (SImode)))));
  966.     }
  967. }
  968.  
  969. /* Copy all or part of a BLKmode value X out of registers starting at REGNO.
  970.    The number of registers to be filled is NREGS.  */
  971.  
  972. void
  973. move_block_from_reg (regno, x, nregs)
  974.      int regno;
  975.      rtx x;
  976.      int nregs;
  977. {
  978.   int i;
  979.   for (i = 0; i < nregs; i++)
  980.     {
  981.       if (GET_CODE (x) == REG)
  982.     emit_move_insn (gen_rtx (SUBREG, SImode, x, i),
  983.             gen_rtx (REG, SImode, regno + i));
  984.       else
  985.     emit_move_insn (gen_rtx (MEM, SImode,
  986.                  memory_address (SImode,
  987.                          plus_constant (XEXP (x, 0),
  988.                                 i * GET_MODE_SIZE (SImode)))),
  989.             gen_rtx (REG, SImode, regno + i));
  990.     }
  991. }
  992.  
  993. /* Mark NREGS consecutive regs, starting at REGNO, as being live now.  */
  994.  
  995. static void
  996. use_regs (regno, nregs)
  997.      int regno;
  998.      int nregs;
  999. {
  1000.   int i;
  1001.   for (i = 0; i < nregs; i++)
  1002.     emit_insn (gen_rtx (USE, VOIDmode, gen_rtx (REG, SImode, regno + i)));
  1003. }
  1004.  
  1005. /* Write zeros through the storage of OBJECT.
  1006.    If OBJECT has BLKmode, SIZE is its length in bytes.  */
  1007.  
  1008. void
  1009. clear_storage (object, size)
  1010.      rtx object;
  1011.      int size;
  1012. {
  1013.   if (GET_MODE (object) == BLKmode)
  1014.     {
  1015. #ifdef TARGET_MEM_FUNCTIONS
  1016.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memset"), 0,
  1017.              VOIDmode, 3,
  1018.              XEXP (object, 0), Pmode, const0_rtx, Pmode,
  1019.              gen_rtx (CONST_INT, VOIDmode, size), Pmode);
  1020. #else
  1021.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bzero"), 0,
  1022.              VOIDmode, 2,
  1023.              XEXP (object, 0), Pmode,
  1024.              gen_rtx (CONST_INT, VOIDmode, size), Pmode);
  1025. #endif
  1026.     }
  1027.   else
  1028.     emit_move_insn (object, const0_rtx);
  1029. }
  1030.  
  1031. /* Generate code to copy Y into X.
  1032.    Both Y and X must have the same mode, except that
  1033.    Y can be a constant with VOIDmode.
  1034.    This mode cannot be BLKmode; use emit_block_move for that.
  1035.  
  1036.    Return the last instruction emitted.  */
  1037.  
  1038. rtx
  1039. emit_move_insn (x, y)
  1040.      rtx x, y;
  1041. {
  1042.   enum machine_mode mode = GET_MODE (x);
  1043.   x = protect_from_queue (x, 1);
  1044.   y = protect_from_queue (y, 0);
  1045.  
  1046.   if ((CONSTANT_P (y) || GET_CODE (y) == CONST_DOUBLE)
  1047.       && ! LEGITIMATE_CONSTANT_P (y))
  1048.     {
  1049.       y = force_const_mem (mode, y);
  1050.       if (! memory_address_p (mode, XEXP (y, 0)))
  1051.     y = gen_rtx (MEM, mode, memory_address (mode, XEXP (y, 0)));
  1052.     }
  1053.  
  1054.   if (mode == BLKmode)
  1055.     abort ();
  1056.   if (mov_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  1057.     return
  1058.       emit_insn (GEN_FCN (mov_optab->handlers[(int) mode].insn_code) (x, y));
  1059. #if 0
  1060.   /* It turns out you get much better optimization (in cse and flow)
  1061.      if you define movdi and movdf instruction patterns
  1062.      even if they must turn into multiple assembler instructions.  */
  1063.   else if (GET_MODE_SIZE (mode) >= GET_MODE_SIZE (SImode))
  1064.     {
  1065.       register int count = GET_MODE_SIZE (mode) / GET_MODE_SIZE (SImode);
  1066.       register int i;
  1067.       if (GET_CODE (y) == CONST_DOUBLE && y != dconst0_rtx)
  1068.     y = force_const_double_mem (y);
  1069.       for (i = 0; i < count; i++)
  1070.     {
  1071.       rtx x1, y1;
  1072.       if (GET_CODE (x) == REG)
  1073.         x1 = gen_rtx (SUBREG, SImode, x, i);
  1074.       else
  1075.         x1 = gen_rtx (MEM, SImode,
  1076.               memory_address (SImode,
  1077.                       plus_constant (XEXP (x, 0),
  1078.                              i * GET_MODE_SIZE (SImode))));
  1079.       if (GET_CODE (y) == REG)
  1080.         y1 = gen_rtx (SUBREG, SImode, y, i);
  1081.       else if (y == dconst0_rtx)
  1082.         y1 = const0_rtx;
  1083.       else
  1084.         y1 = gen_rtx (MEM, SImode,
  1085.               memory_address (SImode,
  1086.                       plus_constant (XEXP (y, 0),
  1087.                              i * GET_MODE_SIZE (SImode))));
  1088.       emit_insn (gen_movsi (protect_from_queue (x1, 1), protect_from_queue (y1, 0)));
  1089.     }
  1090.     }
  1091. #endif
  1092.   else
  1093.     abort ();
  1094. }
  1095.  
  1096. /* Pushing data onto the stack.  */
  1097.  
  1098. /* Push a block of length SIZE (perhaps variable)
  1099.    and return an rtx to address the beginning of the block.
  1100.    Note that it is not possible for the value returned to be a QUEUED.
  1101.    The value may be stack_pointer_rtx.
  1102.  
  1103.    The value we return does take account of STACK_POINTER_OFFSET.  */
  1104.  
  1105. rtx
  1106. push_block (size)
  1107.      rtx size;
  1108. {
  1109.   register rtx temp;
  1110.   if (CONSTANT_P (size) || GET_CODE (size) == REG)
  1111.     anti_adjust_stack (size);
  1112.   else
  1113.     anti_adjust_stack (copy_to_mode_reg (Pmode, size));
  1114.  
  1115. #ifdef STACK_GROWS_DOWNWARD
  1116.   temp = stack_pointer_rtx;
  1117. #else
  1118.   temp = gen_rtx (PLUS, Pmode,
  1119.           stack_pointer_rtx,
  1120.           negate_rtx (Pmode, size));
  1121.   if (GET_CODE (size) != CONST_INT)
  1122.     temp = force_operand (temp, 0);
  1123. #endif
  1124.  
  1125. #ifdef STACK_POINTER_OFFSET
  1126.   temp = plus_constant (temp, STACK_POINTER_OFFSET);
  1127. #endif /* STACK_POINTER_OFFSET */
  1128.  
  1129.   return memory_address (QImode, temp);
  1130. }
  1131.  
  1132. static rtx
  1133. gen_push_operand ()
  1134. {
  1135.   return gen_rtx (
  1136. #ifdef STACK_GROWS_DOWNWARD
  1137.           PRE_DEC,
  1138. #else
  1139.           PRE_INC,
  1140. #endif
  1141.           Pmode,
  1142.           stack_pointer_rtx);
  1143. }
  1144.  
  1145. /* Generate code to push X onto the stack, assuming it has mode MODE.
  1146.    MODE is redundant except when X is a CONST_INT (since they don't
  1147.    carry mode info).
  1148.    SIZE is an rtx for the size of data to be copied (in bytes),
  1149.    needed only if X is BLKmode.
  1150.  
  1151.    ALIGN (in bytes) is maximum alignment we can assume.
  1152.  
  1153.    If PARTIAL is nonzero, then copy that many of the first words
  1154.    of X into registers starting with REG, and push the rest of X.
  1155.    The amount of space pushed is decreased by PARTIAL words,
  1156.    rounded *down* to a multiple of PARM_BOUNDARY.
  1157.    REG must be a hard register in this case.
  1158.  
  1159.    EXTRA is the amount in bytes of extra space to leave next to this arg.
  1160.  
  1161.    On a machine that lacks real push insns, ARGS_ADDR is the address of
  1162.    the bottom of the argument block for this call.  We use indexing off there
  1163.    to store the arg.  On machines with push insns, ARGS_ADDR is 0.
  1164.  
  1165.    ARGS_SO_FAR is the size of args previously pushed for this call.  */
  1166.  
  1167. static void
  1168. emit_push_insn (x, mode, size, align, partial, reg, extra, args_addr, args_so_far)
  1169.      register rtx x;
  1170.      enum machine_mode mode;
  1171.      rtx size;
  1172.      int align;
  1173.      int partial;
  1174.      rtx reg;
  1175.      int extra;
  1176.      rtx args_addr;
  1177.      rtx args_so_far;
  1178. {
  1179.   rtx xinner;
  1180.   enum direction stack_direction
  1181. #ifdef STACK_GROWS_DOWNWARD
  1182.     = downward;
  1183. #else
  1184.     = upward;
  1185. #endif
  1186.  
  1187.   /* Decide where to pad the argument: `downward' for below,
  1188.      `upward' for above, or `none' for don't pad it.
  1189.      Default is below for small data on big-endian machines; else above.  */
  1190.   enum direction where_pad = FUNCTION_ARG_PADDING (mode, size);
  1191.  
  1192.   xinner = x = protect_from_queue (x, 0);
  1193.  
  1194.   if (extra)
  1195.     {
  1196.       if (args_addr == 0)
  1197.     {
  1198.       /* Push padding now if padding above and stack grows down,
  1199.          or if padding below and stack grows up.  */
  1200.       if (where_pad != none && where_pad != stack_direction)
  1201.         anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
  1202.     }
  1203.       else
  1204.     {
  1205.       /* If space already allocated, just adjust the address we use.  */
  1206.       if (where_pad == downward)
  1207.         args_so_far = plus_constant (args_so_far, extra);
  1208.     }
  1209.     }
  1210.  
  1211.   if (mode == BLKmode)
  1212.     {
  1213.       /* Copy a block into the stack, entirely or partially.  */
  1214.  
  1215.       register rtx temp;
  1216.       int used = partial * UNITS_PER_WORD;
  1217.       int offset = used % (PARM_BOUNDARY / BITS_PER_UNIT);
  1218.       int skip;
  1219.       
  1220.       if (size == 0)
  1221.     abort ();
  1222.  
  1223.       used -= offset;
  1224.  
  1225.       /* USED is now the # of bytes we need not copy to the stack
  1226.      because registers will take care of them.  */
  1227.  
  1228.       if (partial != 0)
  1229.     xinner = change_address (xinner, BLKmode,
  1230.                  plus_constant (XEXP (xinner, 0), used));
  1231.  
  1232. /* If the partial register-part of the arg counts in its stack size,
  1233.    skip the part of stack space corresponding to the registers.
  1234.    Otherwise, start copying to the beginning of the stack space,
  1235.    by setting SKIP to 0.  */
  1236. #ifndef FIRST_PARM_CALLER_OFFSET
  1237.       skip = 0;
  1238. #else
  1239.       skip = used;
  1240. #endif
  1241.  
  1242. #ifdef PUSH_ROUNDING
  1243.       /* Do it with several push insns if that doesn't take lots of insns
  1244.      and if there is no difficulty with push insns that skip bytes
  1245.      on the stack for alignment purposes.  */
  1246.       if (args_addr == 0
  1247.       && GET_CODE (size) == CONST_INT
  1248.       && args_addr == 0
  1249.       && skip == 0
  1250.       && (move_by_pieces_ninsns ((unsigned) INTVAL (size) - used, align)
  1251.           < MOVE_RATIO)
  1252.       && PUSH_ROUNDING (INTVAL (size)) == INTVAL (size))
  1253.     move_by_pieces (gen_rtx (MEM, BLKmode, gen_push_operand ()), xinner,
  1254.             INTVAL (size) - used, align);
  1255.       else
  1256. #endif /* PUSH_ROUNDING */
  1257.     {
  1258.       /* Otherwise make space on the stack and copy the data
  1259.          to the address of that space.  */
  1260.  
  1261.       /* Deduct words put into registers from the size we must copy.  */
  1262.       if (partial != 0)
  1263.         {
  1264.           if (GET_CODE (size) == CONST_INT)
  1265.         size = gen_rtx (CONST_INT, VOIDmode, INTVAL (size) - used);
  1266.           else
  1267.         size = expand_binop (GET_MODE (size), sub_optab, size,
  1268.                      gen_rtx (CONST_INT, VOIDmode, used),
  1269.                      0, 0, OPTAB_LIB_WIDEN);
  1270.         }
  1271.  
  1272.       /* Get the address of the stack space.  */
  1273.       if (! args_addr)
  1274.         temp = push_block (size);
  1275.       else if (GET_CODE (args_so_far) == CONST_INT)
  1276.         temp = memory_address (BLKmode,
  1277.                    plus_constant (args_addr,
  1278.                           skip + INTVAL (args_so_far)));
  1279.       else
  1280.         temp = memory_address (BLKmode,
  1281.                    plus_constant (gen_rtx (PLUS, Pmode,
  1282.                                args_addr, args_so_far),
  1283.                           skip));
  1284.  
  1285.       /* TEMP is the address of the block.  Copy the data there.  */
  1286.       if (GET_CODE (size) == CONST_INT
  1287.           && (move_by_pieces_ninsns ((unsigned) INTVAL (size), align)
  1288.           < MOVE_RATIO))
  1289.         {
  1290.           move_by_pieces (gen_rtx (MEM, BLKmode, temp), xinner,
  1291.                   INTVAL (size), align);
  1292.           goto ret;
  1293.         }
  1294.       /* Try the most limited insn first, because there's no point
  1295.          including more than one in the machine description unless
  1296.          the more limited one has some advantage.  */
  1297. #ifdef HAVE_movstrqi
  1298.       if (HAVE_movstrqi
  1299.           && GET_CODE (size) == CONST_INT
  1300.           && ((unsigned) INTVAL (size)
  1301.           < (1 << (GET_MODE_BITSIZE (QImode) - 1))))
  1302.         {
  1303.           emit_insn (gen_movstrqi (gen_rtx (MEM, BLKmode, temp),
  1304.                        xinner, size,
  1305.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1306.           goto ret;
  1307.         }
  1308. #endif
  1309. #ifdef HAVE_movstrhi
  1310.       if (HAVE_movstrhi
  1311.           && GET_CODE (size) == CONST_INT
  1312.           && ((unsigned) INTVAL (size)
  1313.           < (1 << (GET_MODE_BITSIZE (HImode) - 1))))
  1314.         {
  1315.           emit_insn (gen_movstrhi (gen_rtx (MEM, BLKmode, temp),
  1316.                        xinner, size,
  1317.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1318.           goto ret;
  1319.         }
  1320. #endif
  1321. #ifdef HAVE_movstrsi
  1322.       if (HAVE_movstrsi)
  1323.         {
  1324.           emit_insn (gen_movstrsi (gen_rtx (MEM, BLKmode, temp),
  1325.                        xinner, size,
  1326.                        gen_rtx (CONST_INT, VOIDmode, align)));
  1327.           goto ret;
  1328.         }
  1329. #endif
  1330.  
  1331.       if (reg_mentioned_p (stack_pointer_rtx, temp))
  1332.         {
  1333.           /* Now that emit_library_call does force_operand
  1334.          before pushing anything, preadjustment does not work.  */
  1335.           temp = copy_to_reg (temp);
  1336. #if 0
  1337.           /* Correct TEMP so it holds what will be a description of
  1338.          the address to copy to, valid after one arg is pushed.  */
  1339.           int xsize = GET_MODE_SIZE (Pmode);
  1340. #ifdef PUSH_ROUNDING
  1341.           xsize = PUSH_ROUNDING (xsize);
  1342. #endif
  1343.           xsize = ((xsize + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  1344.                / (PARM_BOUNDARY / BITS_PER_UNIT)
  1345.                * (PARM_BOUNDARY / BITS_PER_UNIT));
  1346. #ifdef TARGET_MEM_FUNCTIONS
  1347.           /* If we are calling bcopy, we push one arg before TEMP.
  1348.          If calling memcpy, we push two.  */
  1349.           xsize *= 2;
  1350. #endif
  1351. #ifdef STACK_GROWS_DOWNWARD
  1352.           temp = plus_constant (temp, xsize);
  1353. #else
  1354.           temp = plus_constant (temp, -xsize);
  1355. #endif /* not STACK_GROWS_DOWNWARD */
  1356. #endif /* 0 */
  1357.         }
  1358.  
  1359.       /* Make inhibit_defer_pop nonzero around the library call
  1360.          to force it to pop the bcopy-arguments right away.  */
  1361.       NO_DEFER_POP;
  1362. #ifdef TARGET_MEM_FUNCTIONS
  1363.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "memcpy"), 0,
  1364.                  VOIDmode, 3, temp, Pmode, XEXP (xinner, 0), Pmode,
  1365.                  size, Pmode);
  1366. #else
  1367.       emit_library_call (gen_rtx (SYMBOL_REF, Pmode, "bcopy"), 0,
  1368.                  VOIDmode, 3, XEXP (xinner, 0), Pmode, temp, Pmode,
  1369.                  size, Pmode);
  1370. #endif
  1371.       OK_DEFER_POP;
  1372.     }
  1373.     }
  1374.   else if (partial > 0)
  1375.     {
  1376.       /* Scalar partly in registers.  */
  1377.  
  1378.       int size = GET_MODE_SIZE (mode) / UNITS_PER_WORD;
  1379.       int i;
  1380.       int not_stack;
  1381.       /* # words of start of argument
  1382.      that we must make space for but need not store.  */
  1383.       int offset = partial % (PARM_BOUNDARY / BITS_PER_WORD);
  1384.       int args_offset = INTVAL (args_so_far);
  1385.       int skip;
  1386.  
  1387.       /* If we make space by pushing it, we might as well push
  1388.      the real data.  Otherwise, we can leave OFFSET nonzero
  1389.      and leave the space uninitialized.  */
  1390.       if (args_addr == 0)
  1391.     offset = 0;
  1392.  
  1393.       /* Now NOT_STACK gets the number of words that we don't need to
  1394.      allocate on the stack.  */
  1395.       not_stack = partial - offset;
  1396.  
  1397. /* If the partial register-part of the arg counts in its stack size,
  1398.    skip the part of stack space corresponding to the registers.
  1399.    Otherwise, start copying to the beginning of the stack space,
  1400.    by setting SKIP to 0.  */
  1401. #ifndef FIRST_PARM_CALLER_OFFSET
  1402.       skip = 0;
  1403. #else
  1404.       skip = not_stack;
  1405. #endif
  1406.  
  1407.       if (GET_CODE (x) == CONST_DOUBLE && x != dconst0_rtx)
  1408.     x = force_const_double_mem (x);
  1409.  
  1410.       /* Loop over all the words allocated on the stack for this arg.  */
  1411.       /* We can do it by words, because any scalar bigger than a word
  1412.      has a size a multiple of a word.  */
  1413. #ifndef PUSH_ARGS_REVERSED
  1414.       for (i = not_stack; i < size; i++)
  1415. #else
  1416.       for (i = size - 1; i >= not_stack; i--)
  1417. #endif
  1418.     if (i >= not_stack + offset)
  1419.       {
  1420.         rtx wd;
  1421.         rtx addr;
  1422.         /* Get the next word of the value in WD.  */
  1423.         if (GET_CODE (x) == MEM)
  1424.           {
  1425.         rtx addr = memory_address (SImode,
  1426.                        plus_constant (XEXP (x, 0),
  1427.                               i * UNITS_PER_WORD));
  1428.         /* Copy to a reg, since machine may lack
  1429.            memory-to-memory move insns.  */
  1430.         wd = copy_to_reg (gen_rtx (MEM, SImode, addr));
  1431.           }
  1432.         else if (GET_CODE (x) == REG)
  1433.           wd = gen_rtx (SUBREG, SImode, x, i);
  1434.         else if (x == dconst0_rtx)
  1435.           wd = const0_rtx;
  1436.         else
  1437.           abort ();
  1438.  
  1439.         emit_push_insn (wd,
  1440.                 SImode, 0, align, 0, 0, 0, args_addr,
  1441.                 gen_rtx (CONST_INT, VOIDmode,
  1442.                      args_offset + (i - not_stack + skip) * UNITS_PER_WORD));
  1443.       }
  1444.     }
  1445.   else
  1446.     {
  1447.       rtx addr;
  1448. #ifdef PUSH_ROUNDING
  1449.       if (args_addr == 0)
  1450.     addr = gen_push_operand ();
  1451.       else
  1452. #endif
  1453.     if (GET_CODE (args_so_far) == CONST_INT)
  1454.       addr
  1455.         = memory_address (mode,
  1456.                   plus_constant (args_addr, INTVAL (args_so_far)));
  1457.       else
  1458.     addr = memory_address (mode, gen_rtx (PLUS, Pmode, args_addr,
  1459.                           args_so_far));
  1460.  
  1461.       emit_move_insn (gen_rtx (MEM, mode, addr), x);
  1462.     }
  1463.  
  1464.  ret:
  1465.   /* If part should go in registers, copy that part
  1466.      into the appropriate registers.  Do this now, at the end,
  1467.      since mem-to-mem copies above may do function calls.  */
  1468.   if (partial > 0)
  1469.     move_block_to_reg (REGNO (reg), x, partial);
  1470.  
  1471.   if (extra && args_addr == 0 && where_pad == stack_direction)
  1472.     anti_adjust_stack (gen_rtx (CONST_INT, VOIDmode, extra));
  1473. }
  1474.  
  1475. /* Output a library call to function FUN (a SYMBOL_REF rtx)
  1476.    (emitting the queue unless NO_QUEUE is nonzero),
  1477.    for a value of mode OUTMODE,
  1478.    with NARGS different arguments, passed as alternating rtx values
  1479.    and machine_modes to convert them to.
  1480.    The rtx values should have been passed through protect_from_queue already.  */
  1481.  
  1482. void
  1483. emit_library_call (va_alist)
  1484.      va_dcl
  1485. {
  1486.   register va_list p;
  1487.   register int args_size = 0;
  1488.   register int argnum;
  1489.   enum machine_mode outmode;
  1490.   int nargs;
  1491.   rtx fun;
  1492.   rtx orgfun;
  1493.   int inc;
  1494.   int count;
  1495.   rtx *regvec;
  1496.   rtx argblock = 0;
  1497.   CUMULATIVE_ARGS args_so_far;
  1498.   struct arg { rtx value; enum machine_mode mode; };
  1499.   struct arg *argvec;
  1500.   int old_inhibit_defer_pop = inhibit_defer_pop;
  1501.   int stack_padding = 0;
  1502.   int no_queue = 0;
  1503.   rtx use_insns;
  1504.  
  1505.   va_start (p);
  1506.   orgfun = fun = va_arg (p, rtx);
  1507.   no_queue = va_arg (p, int);
  1508.   outmode = va_arg (p, enum machine_mode);
  1509.   nargs = va_arg (p, int);
  1510.  
  1511.   regvec = (rtx *) alloca (nargs * sizeof (rtx));
  1512.  
  1513.   /* Copy all the libcall-arguments out of the varargs data
  1514.      and into a vector ARGVEC.  */
  1515.   argvec = (struct arg *) alloca (nargs * sizeof (struct arg));
  1516.   for (count = 0; count < nargs; count++)
  1517.     {
  1518.       rtx val = va_arg (p, rtx);
  1519.       enum machine_mode mode = va_arg (p, enum machine_mode);
  1520.  
  1521.       argvec[count].value = val;
  1522.  
  1523.       /* Convert the arg value to the mode the library wants.
  1524.      Also make sure it is a reasonable operand
  1525.      for a move or push insn.  */
  1526.       /* ??? It is wrong to do it here; must do it earlier
  1527.      where we know the signedness of the arg.  */
  1528.       if (GET_MODE (val) != mode && GET_MODE (val) != VOIDmode)
  1529.     {
  1530.       val = gen_reg_rtx (mode);
  1531.       convert_move (val, argvec[count].value, 0);
  1532.     }
  1533.       else if (GET_CODE (val) != REG && GET_CODE (val) != MEM
  1534.            
  1535.            && ! ((CONSTANT_P (val) || GET_CODE (val) == CONST_DOUBLE)
  1536.              && LEGITIMATE_CONSTANT_P (val)))
  1537.     val = force_operand (val, 0);
  1538.  
  1539.       argvec[count].value = val;
  1540.       argvec[count].mode = mode;
  1541.     }
  1542.   va_end (p);
  1543.  
  1544.   /* If we have no actual push instructions, make space for all the args
  1545.      right now.  */
  1546. #ifndef PUSH_ROUNDING
  1547.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
  1548.   for (count = 0; count < nargs; count++)
  1549.     {
  1550.       register enum machine_mode mode = argvec[count].mode;
  1551.       register rtx reg;
  1552.       register int partial;
  1553.  
  1554.       reg = FUNCTION_ARG (args_so_far, mode, (tree)0, 1);
  1555. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  1556.       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, (tree)0, 1);
  1557. #else
  1558.       partial = 0;
  1559. #endif
  1560.       if (reg == 0 || partial != 0)
  1561.     args_size += GET_MODE_SIZE (mode);
  1562.       if (partial != 0)
  1563.     args_size -= partial * GET_MODE_SIZE (SImode);
  1564.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  1565.     }
  1566.  
  1567.   if (args_size != 0)
  1568.     {
  1569. #ifdef STACK_ARGS_ADJUST
  1570.       struct args_size size;
  1571.       size.constant = args_size;
  1572.       size.var = 0;
  1573.       STACK_ARGS_ADJUST (size);
  1574.       args_size = size.constant;
  1575. #endif
  1576.       argblock
  1577.     = push_block (round_push (gen_rtx (CONST_INT, VOIDmode, args_size)));
  1578.     }
  1579. #endif /* no PUSH_ROUNDING */
  1580.  
  1581.   INIT_CUMULATIVE_ARGS (args_so_far, (tree)0);
  1582.  
  1583. #ifdef PUSH_ARGS_REVERSED
  1584.   inc = -1;
  1585.   argnum = nargs - 1;
  1586. #else
  1587.   inc = 1;
  1588.   argnum = 0;
  1589. #endif
  1590.   args_size = stack_padding;
  1591.  
  1592.   for (count = 0; count < nargs; count++, argnum += inc)
  1593.     {
  1594.       register enum machine_mode mode = argvec[argnum].mode;
  1595.       register rtx val = argvec[argnum].value;
  1596.       rtx reg;
  1597.       int partial;
  1598.       int arg_size;
  1599.  
  1600.       reg = FUNCTION_ARG (args_so_far, mode, (tree)0, 1);
  1601.       regvec[argnum] = reg;
  1602. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  1603.       partial = FUNCTION_ARG_PARTIAL_NREGS (args_so_far, mode, (tree)0, 1);
  1604. #else
  1605.       partial = 0;
  1606. #endif
  1607.  
  1608.       if (reg != 0 && partial == 0)
  1609.     emit_move_insn (reg, val);
  1610.       else
  1611.     emit_push_insn (val, mode, 0, 0, partial, reg, 0, argblock,
  1612.             gen_rtx (CONST_INT, VOIDmode, args_size));
  1613.  
  1614.       /* Compute size of stack space used by this argument.  */
  1615.       if (reg == 0 || partial != 0)
  1616.     arg_size = GET_MODE_SIZE (mode);
  1617.       else
  1618.     arg_size = 0;
  1619.       if (partial != 0)
  1620.     arg_size
  1621.       -= ((partial * UNITS_PER_WORD)
  1622.           / (PARM_BOUNDARY / BITS_PER_UNIT)
  1623.           * (PARM_BOUNDARY / BITS_PER_UNIT));
  1624.  
  1625.       args_size += arg_size;
  1626.       NO_DEFER_POP;
  1627.       FUNCTION_ARG_ADVANCE (args_so_far, mode, (tree)0, 1);
  1628.     }
  1629.  
  1630.   /* For version 1.37, try deleting this entirely.  */
  1631.   if (! no_queue)
  1632.     emit_queue ();
  1633.  
  1634.   fun = prepare_call_address (fun, 0);
  1635.  
  1636.   /* Any regs containing parms remain in use through the call.  */
  1637.   start_sequence ();
  1638.   for (count = 0; count < nargs; count++)
  1639.     if (regvec[count] != 0)
  1640.       emit_insn (gen_rtx (USE, VOIDmode, regvec[count]));
  1641.  
  1642.   use_insns = gen_sequence ();
  1643.   end_sequence ();
  1644.  
  1645. #ifdef STACK_BOUNDARY
  1646.   args_size = (args_size + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  1647. #endif
  1648.  
  1649.   /* Don't allow popping to be deferred, since then
  1650.      cse'ing of library calls could delete a call and leave the pop.  */
  1651.   NO_DEFER_POP;
  1652.   emit_call_1 (fun, get_identifier (XSTR (orgfun, 0)), args_size,
  1653.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  1654.            outmode != VOIDmode ? hard_libcall_value (outmode) : 0,
  1655.            old_inhibit_defer_pop + 1, use_insns);
  1656.   OK_DEFER_POP;
  1657. }
  1658.  
  1659. /* Expand an assignment that stores the value of FROM into TO.
  1660.    If WANT_VALUE is nonzero, return an rtx for the value of TO.
  1661.    (This may contain a QUEUED rtx.)
  1662.    Otherwise, the returned value is not meaningful.
  1663.  
  1664.    SUGGEST_REG is no longer actually used.
  1665.    It used to mean, copy the value through a register
  1666.    and return that register, if that is possible.
  1667.    But now we do this if WANT_VALUE.
  1668.  
  1669.    If the value stored is a constant, we return the constant.  */
  1670.  
  1671. rtx
  1672. expand_assignment (to, from, want_value, suggest_reg)
  1673.      tree to, from;
  1674.      int want_value;
  1675.      int suggest_reg;
  1676. {
  1677.   register rtx to_rtx = 0;
  1678.  
  1679.   /* Don't crash if the lhs of the assignment was erroneous.  */
  1680.  
  1681.   if (TREE_CODE (to) == ERROR_MARK)
  1682.     return expand_expr (from, 0, VOIDmode, 0);
  1683.  
  1684.   /* Assignment of a structure component needs special treatment
  1685.      if the structure component's rtx is not simply a MEM.
  1686.      Assignment of an array element at a constant index
  1687.      has the same problem.  */
  1688.  
  1689.   if (TREE_CODE (to) == COMPONENT_REF
  1690.       || (TREE_CODE (to) == ARRAY_REF
  1691.       && TREE_CODE (TREE_OPERAND (to, 1)) == INTEGER_CST
  1692.       && TREE_CODE (TYPE_SIZE (TREE_TYPE (to))) == INTEGER_CST))
  1693.     {
  1694.       register enum machine_mode mode1;
  1695.       int bitsize;
  1696.       int volstruct = 0;
  1697.       tree tem = to;
  1698.       int bitpos = 0;
  1699.       int unsignedp;
  1700.  
  1701.       if (TREE_CODE (to) == COMPONENT_REF)
  1702.     {
  1703.       tree field = TREE_OPERAND (to, 1);
  1704.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  1705.       mode1 = DECL_MODE (TREE_OPERAND (to, 1));
  1706.       unsignedp = TREE_UNSIGNED (field);
  1707.     }
  1708.       else
  1709.     {
  1710.       mode1 = TYPE_MODE (TREE_TYPE (to));
  1711.       bitsize = GET_MODE_BITSIZE (mode1);
  1712.       unsignedp = TREE_UNSIGNED (TREE_TYPE (to));
  1713.     }
  1714.  
  1715.       /* Compute cumulative bit-offset for nested component-refs
  1716.      and array-refs, and find the ultimate containing object.  */
  1717.  
  1718.       while (1)
  1719.     {
  1720.       if (TREE_CODE (tem) == COMPONENT_REF)
  1721.         {
  1722.           bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
  1723.           if (TREE_THIS_VOLATILE (tem))
  1724.         volstruct = 1;
  1725.         }
  1726.       else if (TREE_CODE (tem) == ARRAY_REF
  1727.            && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
  1728.            && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
  1729.         {
  1730.           bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
  1731.              * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
  1732.              * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
  1733.         }
  1734.       else
  1735.         break;
  1736.       tem = TREE_OPERAND (tem, 0);
  1737.     }
  1738.       /* TEM is now the containing data object.  */
  1739.  
  1740.       /* If we are going to use store_bit_field and extract_bit_field,
  1741.      make sure to_rtx will be safe for multiple use.  */
  1742.       if (mode1 == BImode && want_value)
  1743.     tem = stabilize_reference (tem);
  1744.  
  1745.       to_rtx = expand_expr (tem, 0, VOIDmode, 0);
  1746.  
  1747.       return store_field (to_rtx, bitsize, bitpos, mode1, from,
  1748.               (want_value
  1749.                /* Spurious cast makes HPUX compiler happy.  */
  1750.                ? (enum machine_mode) TYPE_MODE (TREE_TYPE (to))
  1751.                : VOIDmode),
  1752.               unsignedp,
  1753.               /* Required alignment of containing datum.  */
  1754.               TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT);
  1755.     }
  1756.  
  1757.   /* Ordinary treatment.  Expand TO to get a REG or MEM rtx.
  1758.      Don't re-expand if it was expanded already (in COMPONENT_REF case).  */
  1759.  
  1760.   if (to_rtx == 0)
  1761.     to_rtx = expand_expr (to, 0, VOIDmode, 0);
  1762.  
  1763.   /* Compute FROM and store the value in the rtx we got.  */
  1764.  
  1765.   return store_expr (from, to_rtx, want_value);
  1766. }
  1767.  
  1768. /* Generate code for computing expression EXP,
  1769.    and storing the value into TARGET.
  1770.    Returns TARGET or an equivalent value.
  1771.    TARGET may contain a QUEUED rtx.
  1772.  
  1773.    If SUGGEST_REG is nonzero, copy the value through a register
  1774.    and return that register, if that is possible.
  1775.  
  1776.    If the value stored is a constant, we return the constant.  */
  1777.  
  1778. rtx
  1779. store_expr (exp, target, suggest_reg)
  1780.      register tree exp;
  1781.      register rtx target;
  1782.      int suggest_reg;
  1783. {
  1784.   register rtx temp;
  1785.   int dont_return_target = 0;
  1786.  
  1787.   /* Copying a non-constant CONSTRUCTOR needs special treatment.  */
  1788.  
  1789.   if (TREE_CODE (exp) == CONSTRUCTOR && ! TREE_LITERAL (exp))
  1790.     {
  1791.       store_constructor (exp, target);
  1792.       return target;
  1793.     }
  1794.  
  1795.   if (suggest_reg && GET_CODE (target) == MEM && GET_MODE (target) != BLKmode)
  1796.     /* If target is in memory and caller wants value in a register instead,
  1797.        arrange that.  Pass TARGET as target for expand_expr so that,
  1798.        if EXP is another assignment, SUGGEST_REG will be nonzero for it.
  1799.        We know expand_expr will not use the target in that case.  */
  1800.     {
  1801.       temp = expand_expr (exp, cse_not_expected ? 0 : target,
  1802.               GET_MODE (target), 0);
  1803.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  1804.     temp = copy_to_reg (temp);
  1805.       dont_return_target = 1;
  1806.     }
  1807.   else if (queued_subexp_p (target))
  1808.     /* If target contains a postincrement, it is not safe
  1809.        to use as the returned value.  It would access the wrong
  1810.        place by the time the queued increment gets output.
  1811.        So copy the value through a temporary and use that temp
  1812.        as the result.  */
  1813.     {
  1814.       temp = expand_expr (exp, 0, GET_MODE (target), 0);
  1815.       if (GET_MODE (temp) != BLKmode && GET_MODE (temp) != VOIDmode)
  1816.     temp = copy_to_reg (temp);
  1817.       dont_return_target = 1;
  1818.     }
  1819.   else
  1820.     {
  1821.       temp = expand_expr (exp, target, GET_MODE (target), 0);
  1822.       /* DO return TARGET if it's a specified hardware register.
  1823.      expand_return relies on this.  */
  1824.       if (!(target && GET_CODE (target) == REG
  1825.         && REGNO (target) < FIRST_PSEUDO_REGISTER)
  1826.       && (CONSTANT_P (temp) || GET_CODE (temp) == CONST_DOUBLE))
  1827.     dont_return_target = 1;
  1828.     }
  1829.  
  1830.   /* If value was not generated in the target, store it there.
  1831.      Convert the value to TARGET's type first if nec.  */
  1832.  
  1833.   if (temp != target && TREE_CODE (exp) != ERROR_MARK)
  1834.     {
  1835.       target = protect_from_queue (target, 1);
  1836.       if (GET_MODE (temp) != GET_MODE (target)
  1837.       && GET_MODE (temp) != VOIDmode)
  1838.     {
  1839.       int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  1840.       if (dont_return_target)
  1841.         {
  1842.           /* In this case, we will return TEMP,
  1843.          so make sure it has the proper mode.
  1844.          But don't forget to store the value into TARGET.  */
  1845.           temp = convert_to_mode (GET_MODE (target), temp, unsignedp);
  1846.           emit_move_insn (target, temp);
  1847.         }
  1848.       else
  1849.         convert_move (target, temp, unsignedp);
  1850.     }
  1851.  
  1852.       else if (GET_MODE (temp) == BLKmode)
  1853.     emit_block_move (target, temp, expr_size (exp),
  1854.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1855.       else
  1856.     emit_move_insn (target, temp);
  1857.     }
  1858.   if (dont_return_target)
  1859.     return temp;
  1860.   return target;
  1861. }
  1862.  
  1863. /* Store the value of constructor EXP into the rtx TARGET.
  1864.    TARGET is either a REG or a MEM.  */
  1865.  
  1866. static void
  1867. store_constructor (exp, target)
  1868.      tree exp;
  1869.      rtx target;
  1870. {
  1871.   /* Don't try copying piece by piece into a hard register
  1872.      since that is vulnerable to being clobbered by EXP.
  1873.      Instead, construct in a pseudo register and then copy it all.  */
  1874.   if (GET_CODE (target) == REG && REGNO (target) < FIRST_PSEUDO_REGISTER)
  1875.     {
  1876.       rtx temp = gen_reg_rtx (GET_MODE (target));
  1877.       store_constructor (exp, temp);
  1878.       emit_move_insn (target, temp);
  1879.       return;
  1880.     }
  1881.  
  1882.   if (TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE)
  1883.     {
  1884.       register tree elt;
  1885.  
  1886.       /* If the constructor has fewer fields than the structure,
  1887.      clear the whole structure first.  */
  1888.  
  1889.       if (list_length (CONSTRUCTOR_ELTS (exp))
  1890.       != list_length (TYPE_FIELDS (TREE_TYPE (exp))))
  1891.     clear_storage (target, int_size_in_bytes (TREE_TYPE (exp)));
  1892.       else
  1893.     /* Inform later passes that the old value is dead.  */
  1894.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  1895.  
  1896.       /* Store each element of the constructor into
  1897.      the corresponding field of TARGET.  */
  1898.  
  1899.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  1900.     {
  1901.       register tree field = TREE_PURPOSE (elt);
  1902.       register enum machine_mode mode;
  1903.       int bitsize;
  1904.       int bitpos;
  1905.       int unsignedp;
  1906.  
  1907.       bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  1908.       mode = DECL_MODE (field);
  1909.       unsignedp = TREE_UNSIGNED (field);
  1910.  
  1911.       bitpos = DECL_OFFSET (field);
  1912.  
  1913.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  1914.                /* The alignment of TARGET is
  1915.               at least what its type requires.  */
  1916.                VOIDmode, 0,
  1917.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1918.     }
  1919.     }
  1920.   else if (TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE)
  1921.     {
  1922.       register tree elt;
  1923.       register int i;
  1924.       tree domain = TYPE_DOMAIN (TREE_TYPE (exp));
  1925.       int minelt = TREE_INT_CST_LOW (TYPE_MIN_VALUE (domain));
  1926.       int maxelt = TREE_INT_CST_LOW (TYPE_MAX_VALUE (domain));
  1927.       tree elttype = TREE_TYPE (TREE_TYPE (exp));
  1928.  
  1929.       /* If the constructor has fewer fields than the structure,
  1930.      clear the whole structure first.  */
  1931.  
  1932.       if (list_length (CONSTRUCTOR_ELTS (exp)) < maxelt - minelt + 1)
  1933.     clear_storage (target, maxelt - minelt + 1);
  1934.       else
  1935.     /* Inform later passes that the old value is dead.  */
  1936.     emit_insn (gen_rtx (CLOBBER, VOIDmode, target));
  1937.  
  1938.       /* Store each element of the constructor into
  1939.      the corresponding element of TARGET, determined
  1940.      by counting the elements.  */
  1941.       for (elt = CONSTRUCTOR_ELTS (exp), i = 0;
  1942.        elt;
  1943.        elt = TREE_CHAIN (elt), i++)
  1944.     {
  1945.       register enum machine_mode mode;
  1946.       int bitsize;
  1947.       int bitpos;
  1948.       int unsignedp;
  1949.  
  1950.       mode = TYPE_MODE (elttype);
  1951.       bitsize = GET_MODE_BITSIZE (mode);
  1952.       unsignedp = TREE_UNSIGNED (elttype);
  1953.  
  1954.       bitpos = (i * TREE_INT_CST_LOW (TYPE_SIZE (elttype))
  1955.             * TYPE_SIZE_UNIT (elttype));
  1956.  
  1957.       store_field (target, bitsize, bitpos, mode, TREE_VALUE (elt),
  1958.                /* The alignment of TARGET is
  1959.               at least what its type requires.  */
  1960.                VOIDmode, 0,
  1961.                TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  1962.     }
  1963.     }
  1964. }
  1965.  
  1966. /* Store the value of EXP (an expression tree)
  1967.    into a subfield of TARGET which has mode MODE and occupies
  1968.    BITSIZE bits, starting BITPOS bits from the start of TARGET.
  1969.  
  1970.    If VALUE_MODE is VOIDmode, return nothing in particular.
  1971.    UNSIGNEDP is not used in this case.
  1972.  
  1973.    Otherwise, return an rtx for the value stored.  This rtx
  1974.    has mode VALUE_MODE if that is convenient to do.
  1975.    In this case, UNSIGNEDP must be nonzero if the value is an unsigned type.
  1976.  
  1977.    ALIGN is the alignment that TARGET is known to have, measured in bytes.  */
  1978.  
  1979. static rtx
  1980. store_field (target, bitsize, bitpos, mode, exp, value_mode, unsignedp, align)
  1981.      rtx target;
  1982.      int bitsize, bitpos;
  1983.      enum machine_mode mode;
  1984.      tree exp;
  1985.      enum machine_mode value_mode;
  1986.      int unsignedp;
  1987.      int align;
  1988. {
  1989.   /* If the structure is in a register or if the component
  1990.      is a bit field, we cannot use addressing to access it.
  1991.      Use bit-field techniques or SUBREG to store in it.  */
  1992.  
  1993.   if (mode == BImode || GET_CODE (target) == REG
  1994.       || GET_CODE (target) == SUBREG)
  1995.     {
  1996.       store_bit_field (target, bitsize, bitpos,
  1997.                mode,
  1998.                expand_expr (exp, 0, VOIDmode, 0),
  1999.                align);
  2000.       if (value_mode != VOIDmode)
  2001.     return extract_bit_field (target, bitsize, bitpos, unsignedp,
  2002.                   0, value_mode, 0, align);
  2003.       return const0_rtx;
  2004.     }
  2005.   else
  2006.     {
  2007.       rtx addr = XEXP (target, 0);
  2008.       rtx to_rtx;
  2009.  
  2010.       /* If a value is wanted, it must be the lhs;
  2011.      so make the address stable for multiple use.  */
  2012.  
  2013.       if (value_mode != VOIDmode && GET_CODE (addr) != REG
  2014.       && ! CONSTANT_ADDRESS_P (addr))
  2015.     addr = copy_to_reg (addr);
  2016.  
  2017.       /* Now build a reference to just the desired component.  */
  2018.  
  2019.       to_rtx = change_address (target, mode,
  2020.                    plus_constant (addr,
  2021.                           (bitpos / BITS_PER_UNIT)));
  2022.       MEM_IN_STRUCT_P (to_rtx) = 1;
  2023.  
  2024.       return store_expr (exp, to_rtx, value_mode != VOIDmode);
  2025.     }
  2026. }
  2027.  
  2028. /* Given an rtx VALUE that may contain additions and multiplications,
  2029.    return an equivalent value that just refers to a register or memory.
  2030.    This is done by generating instructions to perform the arithmetic
  2031.    and returning a pseudo-register containing the value.  */
  2032.  
  2033. rtx
  2034. force_operand (value, target)
  2035.      rtx value, target;
  2036. {
  2037.   register optab binoptab = 0;
  2038.   register rtx op2;
  2039.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  2040.   register rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  2041.  
  2042.   if (GET_CODE (value) == PLUS)
  2043.     binoptab = add_optab;
  2044.   else if (GET_CODE (value) == MINUS)
  2045.     binoptab = sub_optab;
  2046.   else if (GET_CODE (value) == MULT)
  2047.     {
  2048.       op2 = XEXP (value, 1);
  2049.       if (!CONSTANT_P (op2)
  2050.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2051.     subtarget = 0;
  2052.       return expand_mult (GET_MODE (value),
  2053.               force_operand (XEXP (value, 0), subtarget),
  2054.               force_operand (op2, 0),
  2055.               target, 0);
  2056.     }
  2057.  
  2058.   if (binoptab)
  2059.     {
  2060.       op2 = XEXP (value, 1);
  2061.       if (!CONSTANT_P (op2)
  2062.       && !(GET_CODE (op2) == REG && op2 != subtarget))
  2063.     subtarget = 0;
  2064.       if (binoptab == sub_optab
  2065.       && GET_CODE (op2) == CONST_INT && INTVAL (op2) < 0)
  2066.     {
  2067.       binoptab = add_optab;
  2068.       op2 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op2));
  2069.     }
  2070.       return expand_binop (GET_MODE (value), binoptab,
  2071.                force_operand (XEXP (value, 0), subtarget),
  2072.                force_operand (op2, 0),
  2073.                target, 0, OPTAB_LIB_WIDEN);
  2074.       /* We give UNSIGNEP = 0 to expand_binop
  2075.      because the only operations we are expanding here are signed ones.  */
  2076.     }
  2077.   return value;
  2078. }
  2079.  
  2080. /* expand_expr: generate code for computing expression EXP.
  2081.    An rtx for the computed value is returned.  The value is never null.
  2082.    In the case of a void EXP, const0_rtx is returned.
  2083.  
  2084.    The value may be stored in TARGET if TARGET is nonzero.
  2085.    TARGET is just a suggestion; callers must assume that
  2086.    the rtx returned may not be the same as TARGET.
  2087.  
  2088.    If TARGET is CONST0_RTX, it means that the value will be ignored.
  2089.  
  2090.    If TMODE is not VOIDmode, it suggests generating the
  2091.    result in mode TMODE.  But this is done only when convenient.
  2092.    Otherwise, TMODE is ignored and the value generated in its natural mode.
  2093.    TMODE is just a suggestion; callers must assume that
  2094.    the rtx returned may not have mode TMODE.
  2095.  
  2096.    If MODIFIER is EXPAND_SUM then when EXP is an addition
  2097.    we can return an rtx of the form (MULT (REG ...) (CONST_INT ...))
  2098.    or a nest of (PLUS ...) and (MINUS ...) where the terms are
  2099.    products as above, or REG or MEM, or constant.
  2100.    Ordinarily in such cases we would output mul or add instructions
  2101.    and then return a pseudo reg containing the sum.
  2102.  
  2103.    If MODIFIER is EXPAND_CONST_ADDRESS then it is ok to return
  2104.    a MEM rtx whose address is a constant that isn't a legitimate address.  */
  2105.  
  2106. /* Subroutine of expand_expr:
  2107.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  2108.    which can restore these values to their previous values,
  2109.    should something modify their storage.  */
  2110. static tree
  2111. save_noncopied_parts (lhs, list)
  2112.      tree lhs;
  2113.      tree list;
  2114. {
  2115.   tree tail;
  2116.   tree parts = 0;
  2117.  
  2118.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  2119.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  2120.       parts = chainon (parts, save_noncopied_parts (lhs, TREE_VALUE (tail)));
  2121.     else
  2122.       {
  2123.     tree part = TREE_VALUE (tail);
  2124.     tree part_type = TREE_TYPE (part);
  2125.     tree to_be_saved = build (COMPONENT_REF, part_type, lhs, part, 0);
  2126.     rtx target = assign_stack_local (TYPE_MODE (part_type),
  2127.                      int_size_in_bytes (part_type));
  2128.     if (! memory_address_p (TYPE_MODE (part_type), XEXP (target, 0)))
  2129.       target = change_address (target, TYPE_MODE (part_type), 0);
  2130.     parts = tree_cons (to_be_saved,
  2131.                build (RTL_EXPR, part_type, 0, (tree) target),
  2132.                parts);
  2133.     store_expr (TREE_PURPOSE (parts), RTL_EXPR_RTL (TREE_VALUE (parts)), 0);
  2134.       }
  2135.   return parts;
  2136. }
  2137.  
  2138. /* Subroutine of expand_expr:
  2139.    save the non-copied parts (LIST) of an expr (LHS), and return a list
  2140.    which can restore these values to their previous values,
  2141.    should something modify their storage.  */
  2142. static tree
  2143. init_noncopied_parts (lhs, list)
  2144.      tree lhs;
  2145.      tree list;
  2146. {
  2147.   tree tail;
  2148.   tree parts = 0;
  2149.  
  2150.   for (tail = list; tail; tail = TREE_CHAIN (tail))
  2151.     if (TREE_CODE (TREE_VALUE (tail)) == TREE_LIST)
  2152.       parts = chainon (parts, init_noncopied_parts (lhs, TREE_VALUE (tail)));
  2153.     else
  2154.       {
  2155.     tree part = TREE_VALUE (tail);
  2156.     tree part_type = TREE_TYPE (part);
  2157.     tree to_be_initialized = build (COMPONENT_REF, part_type, lhs, part, 0);
  2158.     parts = tree_cons (TREE_PURPOSE (tail), to_be_initialized, parts);
  2159.       }
  2160.   return parts;
  2161. }
  2162.  
  2163. /* Subroutine of expand_expr:
  2164.    return the target to use when recursively expanding
  2165.    the first operand of an arithmetic operation.  */
  2166.  
  2167. static rtx
  2168. validate_subtarget (subtarget, otherop)
  2169.      rtx subtarget;
  2170.      tree otherop;
  2171. {
  2172.   if (TREE_LITERAL (otherop))
  2173.     return subtarget;
  2174.   if (TREE_CODE (otherop) == VAR_DECL
  2175.       && DECL_RTL (otherop) != subtarget)
  2176.     return subtarget;
  2177.   return 0;
  2178. }
  2179.  
  2180. static int
  2181. fixed_type_p (exp)
  2182.      tree exp;
  2183. {
  2184.   if (TREE_CODE (exp) == PARM_DECL
  2185.       || TREE_CODE (exp) == VAR_DECL
  2186.       || TREE_CODE (exp) == CALL_EXPR || TREE_CODE (exp) == NEW_EXPR
  2187.       || TREE_CODE (exp) == COMPONENT_REF
  2188.       || TREE_CODE (exp) == ARRAY_REF)
  2189.     return 1;
  2190.   return 0;
  2191. }
  2192.  
  2193. rtx
  2194. expand_expr (exp, target, tmode, modifier)
  2195.      register tree exp;
  2196.      rtx target;
  2197.      enum machine_mode tmode;
  2198.      enum expand_modifier modifier;
  2199. {
  2200.   extern rtx (*lang_expand_expr)();
  2201.   register rtx op0, op1, temp;
  2202.   tree type = TREE_TYPE (exp);
  2203.   register enum machine_mode mode = TYPE_MODE (type);
  2204.   register enum tree_code code = TREE_CODE (exp);
  2205.   optab this_optab;
  2206.   int negate_1;
  2207.   /* Use subtarget as the target for operand 0 of a binary operation.  */
  2208.   rtx subtarget = (target != 0 && GET_CODE (target) == REG ? target : 0);
  2209.   rtx original_target = target;
  2210.   int ignore = target == const0_rtx;
  2211.  
  2212.   /* Don't use hard regs as subtargets, because the combiner
  2213.      can only handle pseudo regs.  */
  2214.   if (subtarget && REGNO (subtarget) < FIRST_PSEUDO_REGISTER)
  2215.     subtarget = 0;
  2216.   /* Avoid subtargets inside loops,
  2217.      since they hide some invariant expressions.  */
  2218.   if (optimize && inside_loop ())
  2219.     subtarget = 0;
  2220.  
  2221.   if (ignore) target = 0, original_target = 0;
  2222.  
  2223.   /* If will do cse, generate all results into registers
  2224.      since 1) that allows cse to find more things
  2225.      and 2) otherwise cse could produce an insn the machine
  2226.      cannot support.  */
  2227.  
  2228.   if (! cse_not_expected && mode != BLKmode)
  2229.     target = subtarget;
  2230.  
  2231.   /* No sense saving up arithmetic to be done
  2232.      if it's all in the wrong mode to form part of an address.
  2233.      And force_operand won't know whether to sign-extend or zero-extend.  */
  2234.  
  2235.   if (mode != Pmode && modifier == EXPAND_SUM)
  2236.     modifier = EXPAND_NORMAL;
  2237.  
  2238.   switch (code)
  2239.     {
  2240.     case PARM_DECL:
  2241.       if (DECL_RTL (exp) == 0)
  2242.     {
  2243.       error_with_decl (exp, "prior parameter's size depends on `%s'");
  2244.       return const0_rtx;
  2245.     }
  2246.  
  2247.     case FUNCTION_DECL:
  2248.     case VAR_DECL:
  2249.     case RESULT_DECL:
  2250.       if (DECL_RTL (exp) == 0)
  2251.     abort ();
  2252.       /* This is the case of an array whose size is to be determined
  2253.      from its initializer, while the initializer is still being parsed.
  2254.      See expand_decl.  */
  2255.       if (GET_CODE (DECL_RTL (exp)) == MEM
  2256.       && GET_CODE (XEXP (DECL_RTL (exp), 0)) == REG)
  2257.     return change_address (DECL_RTL (exp), GET_MODE (DECL_RTL (exp)),
  2258.                    XEXP (DECL_RTL (exp), 0));
  2259.       if (GET_CODE (DECL_RTL (exp)) == MEM
  2260.       && modifier != EXPAND_CONST_ADDRESS)
  2261.     {
  2262.       /* DECL_RTL probably contains a constant address.
  2263.          On RISC machines where a constant address isn't valid,
  2264.          make some insns to get that address into a register.  */
  2265.       if (!memory_address_p (DECL_MODE (exp), XEXP (DECL_RTL (exp), 0))
  2266.           || (flag_force_addr
  2267.           && CONSTANT_ADDRESS_P (XEXP (DECL_RTL (exp), 0))))
  2268.         return change_address (DECL_RTL (exp), VOIDmode,
  2269.                    copy_rtx (XEXP (DECL_RTL (exp), 0)));
  2270.     }
  2271.       return DECL_RTL (exp);
  2272.  
  2273.     case INTEGER_CST:
  2274.       if (GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_INT)
  2275.     return gen_rtx (CONST_INT, VOIDmode, TREE_INT_CST_LOW (exp));
  2276.       /* Generate immediate CONST_DOUBLE
  2277.      which will be turned into memory by reload if necessary.  */
  2278.       return immed_double_const (TREE_INT_CST_LOW (exp),
  2279.                  TREE_INT_CST_HIGH (exp),
  2280.                  mode);
  2281.  
  2282.     case CONST_DECL:
  2283.       return expand_expr (DECL_INITIAL (exp), target, VOIDmode, 0);
  2284.  
  2285.     case REAL_CST:
  2286.       /* If optimized, generate immediate CONST_DOUBLE
  2287.      which will be turned into memory by reload if necessary.  */
  2288.       if (!cse_not_expected)
  2289.     return immed_real_const (exp);
  2290.     case COMPLEX_CST:
  2291.     case STRING_CST:
  2292.       if (! TREE_CST_RTL (exp))
  2293.     output_constant_def (exp);
  2294.  
  2295.       /* TREE_CST_RTL probably contains a constant address.
  2296.      On RISC machines where a constant address isn't valid,
  2297.      make some insns to get that address into a register.  */
  2298.       if (GET_CODE (TREE_CST_RTL (exp)) == MEM
  2299.       && modifier != EXPAND_CONST_ADDRESS
  2300.       && !memory_address_p (mode, XEXP (TREE_CST_RTL (exp), 0)))
  2301.     return change_address (TREE_CST_RTL (exp), VOIDmode,
  2302.                    copy_rtx (XEXP (TREE_CST_RTL (exp), 0)));
  2303.       return TREE_CST_RTL (exp);
  2304.  
  2305.     case SAVE_EXPR:
  2306.       if (SAVE_EXPR_RTL (exp) == 0)
  2307.     {
  2308.       rtx reg = gen_reg_rtx (mode);
  2309.       SAVE_EXPR_RTL (exp) = reg;
  2310.       store_expr (TREE_OPERAND (exp, 0), reg, 0);
  2311.       if (!optimize)
  2312.         save_expr_regs = gen_rtx (EXPR_LIST, VOIDmode, reg,
  2313.                       save_expr_regs);
  2314.     }
  2315.       /* Don't let the same rtl node appear in two places.  */
  2316.       return SAVE_EXPR_RTL (exp);
  2317.  
  2318.     case IF_STMT:
  2319.       emit_line_note (STMT_SOURCE_FILE (exp), STMT_SOURCE_LINE (exp));
  2320.  
  2321.       /* Exit flag is 0 for now.  */
  2322.       expand_start_cond (STMT_COND (exp), 0);
  2323.       expand_expr_stmt (STMT_THEN (exp));
  2324.       if (STMT_ELSE (exp) == 0)
  2325.     expand_end_cond ();
  2326.       else
  2327.     {
  2328.       expand_start_else ();
  2329.       expand_expr_stmt (STMT_ELSE (exp));
  2330.       expand_end_else ();
  2331.     }
  2332.       return const0_rtx;
  2333.  
  2334.     case LOOP_STMT:
  2335.       {
  2336.     tree vars = STMT_LOOP_VARS (exp);
  2337.  
  2338.     emit_line_note (STMT_SOURCE_FILE (exp), STMT_SOURCE_LINE (exp));
  2339.  
  2340.     while (vars)
  2341.       {
  2342.         if (DECL_RTL (vars) == 0)
  2343.           {
  2344.         expand_decl (vars);
  2345.         expand_decl_init (vars);
  2346.           }
  2347.         vars = TREE_CHAIN (vars);
  2348.       }
  2349.  
  2350.     if (TREE_READONLY (exp))
  2351.       {
  2352.         /* Looks like a `while-do' loop.  */
  2353.         expand_start_loop (1);
  2354.         expand_exit_loop_if_false (STMT_LOOP_COND (exp));
  2355.         expand_expr_stmt (STMT_LOOP_BODY (exp));
  2356.         expand_end_loop ();
  2357.       }
  2358.     else
  2359.       {
  2360.         /* Looks like a `do-while' loop.  */
  2361.         expand_start_loop_continue_elsewhere (1);
  2362.         expand_expr_stmt (STMT_LOOP_BODY (exp));
  2363.         expand_loop_continue_here ();
  2364.         expand_exit_loop_if_false (STMT_LOOP_COND (exp));
  2365.         expand_end_loop ();
  2366.       }
  2367.  
  2368.     if (obey_regdecls)
  2369.       for (vars = STMT_LOOP_VARS (exp); vars; vars = TREE_CHAIN (vars))
  2370.         use_variable (DECL_RTL (vars));
  2371.       }
  2372.       return const0_rtx;
  2373.  
  2374.     case LET_STMT:
  2375.       {
  2376.     tree vars = STMT_VARS (exp);
  2377.  
  2378.     TREE_USED (exp) = 1;
  2379.  
  2380.     /* If VARS have not yet been expanded, expand them now.  */
  2381.     while (vars)
  2382.       {
  2383.         if (DECL_RTL (vars) == 0)
  2384.           {
  2385.         expand_decl (vars);
  2386.         expand_decl_init (vars);
  2387.           }
  2388.         vars = TREE_CHAIN (vars);
  2389.       }
  2390.  
  2391.     temp = expand_expr (STMT_BODY (exp), target, tmode, modifier);
  2392.  
  2393.     if (obey_regdecls)
  2394.       for (vars = STMT_VARS (exp); vars; vars = TREE_CHAIN (vars))
  2395.         use_variable (DECL_RTL (vars));
  2396.  
  2397.     return temp;
  2398.       }
  2399.  
  2400.     case RTL_EXPR:
  2401.       if (RTL_EXPR_SEQUENCE (exp) == const0_rtx)
  2402.     abort ();
  2403.       emit_insns (RTL_EXPR_SEQUENCE (exp));
  2404.       RTL_EXPR_SEQUENCE (exp) = const0_rtx;
  2405.       return RTL_EXPR_RTL (exp);
  2406.  
  2407.     case CONSTRUCTOR:
  2408.       /* All elts simple constants => refer to a constant in memory.  */
  2409.       if (TREE_STATIC (exp))
  2410.     /* For aggregate types with non-BLKmode modes,
  2411.        this should ideally construct a CONST_INT.  */
  2412.     {
  2413.       rtx constructor = output_constant_def (exp);
  2414.       if (! memory_address_p (GET_MODE (constructor),
  2415.                   XEXP (constructor, 0)))
  2416.         constructor = change_address (constructor, VOIDmode,
  2417.                       XEXP (constructor, 0));
  2418.       return constructor;
  2419.     }
  2420.  
  2421.       if (ignore)
  2422.     {
  2423.       tree elt;
  2424.       for (elt = CONSTRUCTOR_ELTS (exp); elt; elt = TREE_CHAIN (elt))
  2425.         expand_expr (TREE_VALUE (elt), const0_rtx, VOIDmode, 0);
  2426.       return const0_rtx;
  2427.     }
  2428.       else
  2429.     {
  2430.       if (target == 0)
  2431.         target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  2432.                   get_structure_value_addr (expr_size (exp)));
  2433.       store_expr (exp, target, 0);
  2434.       return target;
  2435.     }
  2436.  
  2437.     case INDIRECT_REF:
  2438.       {
  2439.     tree exp1 = TREE_OPERAND (exp, 0);
  2440.     tree exp2;
  2441.  
  2442.     /* A SAVE_EXPR as the address in an INDIRECT_EXPR is generated
  2443.        for  *PTR += ANYTHING  where PTR is put inside the SAVE_EXPR.
  2444.        This code has the same general effect as simply doing
  2445.        expand_expr on the save expr, except that the expression PTR
  2446.        is computed for use as a memory address.  This means different
  2447.        code, suitable for indexing, may be generated.  */
  2448.     if (TREE_CODE (exp1) == SAVE_EXPR
  2449.         && SAVE_EXPR_RTL (exp1) == 0
  2450.         && TREE_CODE (exp2 = TREE_OPERAND (exp1, 0)) != ERROR_MARK
  2451.         && TYPE_MODE (TREE_TYPE (exp1)) == Pmode
  2452.         && TYPE_MODE (TREE_TYPE (exp2)) == Pmode)
  2453.       {
  2454.         temp = expand_expr (TREE_OPERAND (exp1, 0), 0, VOIDmode, EXPAND_SUM);
  2455.         op0 = memory_address (mode, temp);
  2456.         op0 = copy_all_regs (op0);
  2457.         SAVE_EXPR_RTL (exp1) = op0;
  2458.       }
  2459.     else
  2460.       {
  2461.         if (modifier == EXPAND_INTO_STACK
  2462.         && original_target
  2463.         && GET_CODE (original_target) == MEM)
  2464.           op0 = expand_expr (exp1, XEXP (original_target, 0),
  2465.                  VOIDmode, EXPAND_INTO_STACK);
  2466.         else
  2467.           op0 = expand_expr (exp1, 0, VOIDmode, EXPAND_SUM);
  2468.         op0 = memory_address (mode, op0);
  2469.       }
  2470.       }
  2471.       temp = gen_rtx (MEM, mode, op0);
  2472.       /* If address was computed by addition,
  2473.      mark this as an element of an aggregate.  */
  2474.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == PLUS_EXPR
  2475.       || (TREE_CODE (TREE_OPERAND (exp, 0)) == SAVE_EXPR
  2476.           && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == PLUS_EXPR))
  2477.     MEM_IN_STRUCT_P (temp) = 1;
  2478.       MEM_VOLATILE_P (temp) = TREE_THIS_VOLATILE (exp) || flag_volatile;
  2479.       RTX_UNCHANGING_P (temp) = TREE_READONLY (exp);
  2480.       return temp;
  2481.  
  2482.     case ARRAY_REF:
  2483.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != INTEGER_CST
  2484.       || TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
  2485.     {
  2486.       /* Nonconstant array index or nonconstant element size.
  2487.          Generate the tree for *(&array+index) and expand that,
  2488.          except do it in a language-independent way
  2489.          and don't complain about non-lvalue arrays.
  2490.          `mark_addressable' should already have been called
  2491.          for any array for which this case will be reached.  */
  2492.  
  2493.       tree array_adr = build (ADDR_EXPR, TYPE_POINTER_TO (type),
  2494.                   TREE_OPERAND (exp, 0));
  2495.       tree index = TREE_OPERAND (exp, 1);
  2496.       tree elt;
  2497.  
  2498.       /* Convert the integer argument to a type the same size as a pointer
  2499.          so the multiply won't overflow spuriously.  */
  2500.       if (TYPE_PRECISION (TREE_TYPE (index)) != POINTER_SIZE)
  2501.         index = convert (type_for_size (POINTER_SIZE, 0), index);
  2502.  
  2503.       /* The array address isn't volatile even if the array is.  */
  2504.       TREE_VOLATILE (array_adr) = 0;
  2505.  
  2506.       elt = build (INDIRECT_REF, type,
  2507.                fold (build (PLUS_EXPR, TYPE_POINTER_TO (type),
  2508.                     array_adr,
  2509.                     fold (build (MULT_EXPR,
  2510.                          TYPE_POINTER_TO (type),
  2511.                          index, size_in_bytes (type))))));
  2512.  
  2513.       return expand_expr (elt, target, tmode, modifier);
  2514.     }
  2515.  
  2516.       /* Fold an expression like: "foo"[2].
  2517.      This is not done in fold so it won't happen inside &.  */
  2518.       {
  2519.     int i;
  2520.     tree arg0 = TREE_OPERAND (exp, 0);
  2521.     tree arg1 = TREE_OPERAND (exp, 1);
  2522.  
  2523.     if (TREE_CODE (arg0) == STRING_CST
  2524.         && TREE_CODE (arg1) == INTEGER_CST
  2525.         && !TREE_INT_CST_HIGH (arg1)
  2526.         && (i = TREE_INT_CST_LOW (arg1)) < TREE_STRING_LENGTH (arg0))
  2527.       {
  2528.         if (TREE_TYPE (TREE_TYPE (arg0)) == integer_type_node)
  2529.           {
  2530.         exp = build_int_2 (((int *)TREE_STRING_POINTER (arg0))[i], 0);
  2531.         TREE_TYPE (exp) = integer_type_node;
  2532.         return expand_expr (exp, target, tmode, modifier);
  2533.           }
  2534.         if (TREE_TYPE (TREE_TYPE (arg0)) == char_type_node)
  2535.           {
  2536.         exp = build_int_2 (TREE_STRING_POINTER (arg0)[i], 0);
  2537.         TREE_TYPE (exp) = integer_type_node;
  2538.         return expand_expr (convert (TREE_TYPE (TREE_TYPE (arg0)), exp), target, tmode, modifier);
  2539.           }
  2540.       }
  2541.       }
  2542.  
  2543.       /* If this is a constant index into a constant array,
  2544.      just get the value from the array.  */
  2545.       if (TREE_READONLY (TREE_OPERAND (exp, 0))
  2546.       && ! TREE_VOLATILE (TREE_OPERAND (exp, 0))
  2547.       && TREE_CODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == ARRAY_TYPE
  2548.       && TREE_LITERAL (TREE_OPERAND (exp, 1))
  2549.       && TREE_CODE (TREE_OPERAND (exp, 0)) == VAR_DECL
  2550.       && DECL_INITIAL (TREE_OPERAND (exp, 0))
  2551.       && TREE_CODE (DECL_INITIAL (TREE_OPERAND (exp, 0))) != ERROR_MARK)
  2552.     {
  2553.       tree index = fold (TREE_OPERAND (exp, 1));
  2554.       if (TREE_CODE (index) == INTEGER_CST)
  2555.         {
  2556.           int i = TREE_INT_CST_LOW (index);
  2557.           tree init = CONSTRUCTOR_ELTS (DECL_INITIAL (TREE_OPERAND (exp, 0)));
  2558.  
  2559.           while (init && i--)
  2560.         init = TREE_CHAIN (init);
  2561.           if (init)
  2562.         return expand_expr (fold (TREE_VALUE (init)), target, tmode, modifier);
  2563.         }
  2564.     }
  2565.       /* Treat array-ref with constant index as a component-ref.  */
  2566.  
  2567.     case COMPONENT_REF:
  2568.       {
  2569.     register enum machine_mode mode1;
  2570.     int volstruct = 0;
  2571.     int bitsize;
  2572.     tree tem = exp;
  2573.     int bitpos = 0;
  2574.     int unsignedp;
  2575.  
  2576.     if (TREE_CODE (exp) == COMPONENT_REF)
  2577.       {
  2578.         tree field = TREE_OPERAND (exp, 1);
  2579.         bitsize = TREE_INT_CST_LOW (DECL_SIZE (field)) * DECL_SIZE_UNIT (field);
  2580.         mode1 = DECL_MODE (field);
  2581.         unsignedp = TREE_UNSIGNED (field);
  2582.       }
  2583.     else
  2584.       {
  2585.         mode1 = TYPE_MODE (TREE_TYPE (exp));
  2586.         bitsize = GET_MODE_BITSIZE (mode1);
  2587.         unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2588.       }
  2589.  
  2590.     /* Compute cumulative bit-offset for nested component-refs
  2591.        and array-refs, and find the ultimate containing object.  */
  2592.  
  2593.     while (1)
  2594.       {
  2595.         if (TREE_CODE (tem) == COMPONENT_REF)
  2596.           {
  2597.         bitpos += DECL_OFFSET (TREE_OPERAND (tem, 1));
  2598.         if (TREE_THIS_VOLATILE (tem))
  2599.           volstruct = 1;
  2600.           }
  2601.         else if (TREE_CODE (tem) == ARRAY_REF
  2602.              && TREE_CODE (TREE_OPERAND (tem, 1)) == INTEGER_CST
  2603.              && TREE_CODE (TYPE_SIZE (TREE_TYPE (tem))) == INTEGER_CST)
  2604.           {
  2605.         bitpos += (TREE_INT_CST_LOW (TREE_OPERAND (tem, 1))
  2606.                * TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (tem)))
  2607.                * TYPE_SIZE_UNIT (TREE_TYPE (tem)));
  2608.           }
  2609.         else
  2610.           break;
  2611.         tem = TREE_OPERAND (tem, 0);
  2612.       }
  2613.  
  2614.     op0 = expand_expr (tem, 0, VOIDmode,
  2615.                (modifier == EXPAND_CONST_ADDRESS
  2616.                 ? modifier : EXPAND_NORMAL));
  2617.  
  2618.     if (mode1 == BImode || GET_CODE (op0) == REG
  2619.         || GET_CODE (op0) == SUBREG)
  2620.       return extract_bit_field (op0, bitsize, bitpos, unsignedp,
  2621.                     target, mode, tmode,
  2622.                     TYPE_ALIGN (TREE_TYPE (tem)) / BITS_PER_UNIT);
  2623.     /* Get a reference to just this component.  */
  2624.     if (modifier == EXPAND_CONST_ADDRESS)
  2625.       op0 = gen_rtx (MEM, mode1, plus_constant (XEXP (op0, 0),
  2626.                             (bitpos / BITS_PER_UNIT)));
  2627.     else
  2628.       op0 = change_address (op0, mode1,
  2629.                 plus_constant (XEXP (op0, 0),
  2630.                            (bitpos / BITS_PER_UNIT)));
  2631.     MEM_IN_STRUCT_P (op0) = 1;
  2632.     MEM_VOLATILE_P (op0) |= volstruct;
  2633.     /* If OP0 is in the shared structure-value stack slot,
  2634.        and it is not BLKmode, copy it into a register.
  2635.        The shared slot may be clobbered at any time by another call.
  2636.        BLKmode is safe because our caller will either copy the value away
  2637.        or take another component and come back here.  */
  2638.     if (mode != BLKmode
  2639.         && TREE_CODE (TREE_OPERAND (exp, 0)) == CALL_EXPR
  2640.         && TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))) == BLKmode)
  2641.       op0 = copy_to_reg (op0);
  2642.     if (mode == mode1 || mode1 == BLKmode || mode1 == tmode)
  2643.       return op0;
  2644.     if (target == 0)
  2645.       target = gen_reg_rtx (tmode != VOIDmode ? tmode : mode);
  2646.     convert_move (target, op0, unsignedp);
  2647.     return target;
  2648.       }
  2649.  
  2650.       /* Intended for a reference to a buffer of a file-object in Pascal.
  2651.      But it's not certain that a special tree code will really be
  2652.      necessary for these.  INDIRECT_REF might work for them.  */
  2653.     case BUFFER_REF:
  2654.       abort ();
  2655.  
  2656.     case WITH_CLEANUP_EXPR:
  2657.       if (RTL_EXPR_RTL (exp) == 0)
  2658.     {
  2659.       RTL_EXPR_RTL (exp)
  2660.         = expand_expr (TREE_OPERAND (exp, 0), target, tmode, modifier);
  2661.       cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2), cleanups_this_call);
  2662.       /* That's it for this cleanup.  */
  2663.       TREE_OPERAND (exp, 2) = 0;
  2664.     }
  2665.       return RTL_EXPR_RTL (exp);
  2666.  
  2667.     case OFFSET_REF:
  2668.       return expand_expr (resolve_offset_ref (exp), target, tmode, modifier);
  2669.  
  2670.     case CALL_EXPR:
  2671.       /* Check for a built-in function.  */
  2672.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  2673.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  2674.       && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  2675.           != NOT_BUILT_IN))
  2676.     return expand_builtin (exp, target, subtarget, tmode, ignore);
  2677.       /* If this call was expanded already by preexpand_calls,
  2678.      just return the result we got.  */
  2679.       if (CALL_EXPR_RTL (exp) != 0)
  2680.     return CALL_EXPR_RTL (exp);
  2681.       return expand_call (exp,
  2682.               (modifier == EXPAND_INTO_STACK) ? original_target : target,
  2683.               ignore, modifier);
  2684.  
  2685.     case NOP_EXPR:
  2686.     case CONVERT_EXPR:
  2687.     case REFERENCE_EXPR:
  2688.       if (TREE_CODE (type) == VOID_TYPE || ignore)
  2689.     {
  2690.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, modifier);
  2691.       return const0_rtx;
  2692.     }
  2693.       if (mode == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))))
  2694.     return expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, modifier);
  2695.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, mode, 0);
  2696.       if (GET_MODE (op0) == mode || GET_MODE (op0) == VOIDmode)
  2697.     return op0;
  2698.       if (flag_force_mem && GET_CODE (op0) == MEM)
  2699.     op0 = copy_to_reg (op0);
  2700.       if (GET_MODE (op0) == VOIDmode)
  2701.     /* Avoid problem in convert_move due to unknown mode of OP0.  */
  2702.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  2703.                 op0);
  2704.       if (target == 0)
  2705.     target = gen_reg_rtx (mode);
  2706.       convert_move (target, op0, TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0))));
  2707.       return target;
  2708.  
  2709.     case PLUS_EXPR:
  2710.       preexpand_calls (exp);
  2711.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST
  2712.       && modifier == EXPAND_SUM)
  2713.     {
  2714.       op1 = expand_expr (TREE_OPERAND (exp, 1), subtarget, VOIDmode, EXPAND_SUM);
  2715.       op1 = plus_constant (op1, TREE_INT_CST_LOW (TREE_OPERAND (exp, 0)));
  2716.       return op1;
  2717.     }
  2718.       negate_1 = 1;
  2719.     plus_minus:
  2720.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2721.       && modifier == EXPAND_SUM)
  2722.     {
  2723.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2724.       op0 = plus_constant (op0,
  2725.                    negate_1 * TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)));
  2726.       return op0;
  2727.     }
  2728.       this_optab = add_optab;
  2729.       if (modifier != EXPAND_SUM) goto binop;
  2730.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2731.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2732.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, EXPAND_SUM);
  2733.       /* Put a sum last, to simplify what follows.  */
  2734. #ifdef OLD_INDEXING
  2735.       if (GET_CODE (op1) == MULT)
  2736.     {
  2737.       temp = op0;
  2738.       op0 = op1;
  2739.       op1 = temp;
  2740.     }
  2741. #endif
  2742. #ifndef OLD_INDEXING
  2743.       /* Make sure any term that's a sum with a constant comes last.  */
  2744.       if (GET_CODE (op0) == PLUS
  2745.       && CONSTANT_P (XEXP (op0, 1)))
  2746.     {
  2747.       temp = op0;
  2748.       op0 = op1;
  2749.       op1 = temp;
  2750.     }
  2751.       /* If adding to a sum including a constant,
  2752.      associate it to put the constant outside.  */
  2753.       if (GET_CODE (op1) == PLUS
  2754.       && CONSTANT_P (XEXP (op1, 1)))
  2755.     {
  2756.       rtx tem;
  2757.       int constant_term = 0;
  2758.  
  2759.       op0 = gen_rtx (PLUS, mode, XEXP (op1, 0), op0);
  2760.       /* Let's also eliminate constants from op0 if possible.  */
  2761.       tem = eliminate_constant_term (op0, &constant_term);
  2762.       if (GET_CODE (XEXP (op1, 1)) == CONST_INT)
  2763.         {
  2764.           if (constant_term != 0)
  2765.         return plus_constant (tem, INTVAL (XEXP (op1, 1)) + constant_term);
  2766.           else
  2767.         return plus_constant (op0, INTVAL (XEXP (op1, 1)));
  2768.         }
  2769.       else
  2770.         return gen_rtx (PLUS, mode, op0, XEXP (op1, 1));
  2771.     }
  2772. #endif
  2773.       return gen_rtx (PLUS, mode, op0, op1);
  2774.  
  2775.     case MINUS_EXPR:
  2776.       preexpand_calls (exp);
  2777.       if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2778.       && GET_MODE_BITSIZE (TYPE_MODE (type)) <= HOST_BITS_PER_INT)
  2779.     {
  2780.       int negated;
  2781.       if (modifier == EXPAND_SUM)
  2782.         {
  2783.           negate_1 = -1;
  2784.           goto plus_minus;
  2785.         }
  2786.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2787.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2788.       negated = - TREE_INT_CST_LOW (TREE_OPERAND (exp, 1));
  2789.       if (GET_MODE_BITSIZE (mode) < HOST_BITS_PER_INT)
  2790.         negated &= (1 << GET_MODE_BITSIZE (mode)) - 1;
  2791.       op1 = gen_rtx (CONST_INT, VOIDmode, negated);
  2792.       this_optab = add_optab;
  2793.       goto binop2;
  2794.     }
  2795.       this_optab = sub_optab;
  2796.       goto binop;
  2797.  
  2798.     case MULT_EXPR:
  2799.       preexpand_calls (exp);
  2800.       /* If first operand is constant, swap them.
  2801.      Thus the following special case checks need only
  2802.      check the second operand.  */
  2803.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == INTEGER_CST)
  2804.     {
  2805.       register tree t1 = TREE_OPERAND (exp, 0);
  2806.       TREE_OPERAND (exp, 0) = TREE_OPERAND (exp, 1);
  2807.       TREE_OPERAND (exp, 1) = t1;
  2808.     }
  2809.  
  2810.       /* Attempt to return something suitable for generating an
  2811.      indexed address, for machines that support that.  */
  2812.  
  2813.       if (modifier == EXPAND_SUM
  2814.       && TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  2815.     {
  2816.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, EXPAND_SUM);
  2817.  
  2818.       /* Apply distributive law if OP0 is x+c.  */
  2819.       if (GET_CODE (op0) == PLUS
  2820.           && GET_CODE (XEXP (op0, 1)) == CONST_INT)
  2821.         return gen_rtx (PLUS, mode,
  2822.                 gen_rtx (MULT, mode, XEXP (op0, 0),
  2823.                      gen_rtx (CONST_INT, VOIDmode,
  2824.                           TREE_INT_CST_LOW (TREE_OPERAND (exp, 1)))),
  2825.                 gen_rtx (CONST_INT, VOIDmode,
  2826.                      (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))
  2827.                       * INTVAL (XEXP (op0, 1)))));
  2828.  
  2829.       if (GET_CODE (op0) != REG)
  2830.         op0 = force_operand (op0, 0);
  2831.       if (GET_CODE (op0) != REG)
  2832.         op0 = copy_to_mode_reg (mode, op0);
  2833.  
  2834.       return gen_rtx (MULT, mode, op0,
  2835.               gen_rtx (CONST_INT, VOIDmode,
  2836.                    TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))));
  2837.     }
  2838.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2839.       /* Check for multiplying things that have been extended
  2840.      from a narrower type.  If this machine supports multiplying
  2841.      in that narrower type with a result in the desired type,
  2842.      do it that way, and avoid the explicit type-conversion.  */
  2843.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == NOP_EXPR
  2844.       && TREE_CODE (TREE_TYPE (exp)) == INTEGER_TYPE
  2845.       && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2846.           < TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (exp, 0))))
  2847.       && ((TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST
  2848.            && int_fits_type_p (TREE_OPERAND (exp, 1),
  2849.                    TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2850.            /* Don't use a widening multiply if a shift will do.  */
  2851.            && exact_log2 (TREE_INT_CST_LOW (TREE_OPERAND (exp, 1))) < 0)
  2852.           ||
  2853.           (TREE_CODE (TREE_OPERAND (exp, 1)) == NOP_EXPR
  2854.            && (TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  2855.            ==
  2856.            TYPE_PRECISION (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
  2857.            /* If both operands are extended, they must either both
  2858.           be zero-extended or both be sign-extended.  */
  2859.            && (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 1), 0)))
  2860.            ==
  2861.            TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))))))
  2862.     {
  2863.       enum machine_mode innermode
  2864.         = TYPE_MODE (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)));
  2865.       this_optab = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)))
  2866.             ? umul_widen_optab : smul_widen_optab);
  2867.       if (mode == GET_MODE_WIDER_MODE (innermode)
  2868.           && this_optab->handlers[(int) mode].insn_code != CODE_FOR_nothing)
  2869.         {
  2870.           op0 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
  2871.                  0, VOIDmode, 0);
  2872.           if (TREE_CODE (TREE_OPERAND (exp, 1)) == INTEGER_CST)
  2873.         op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2874.           else
  2875.         op1 = expand_expr (TREE_OPERAND (TREE_OPERAND (exp, 1), 0),
  2876.                    0, VOIDmode, 0);
  2877.           goto binop2;
  2878.         }
  2879.     }
  2880.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2881.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2882.       return expand_mult (mode, op0, op1, target, TREE_UNSIGNED (type));
  2883.  
  2884.     case TRUNC_DIV_EXPR:
  2885.     case FLOOR_DIV_EXPR:
  2886.     case CEIL_DIV_EXPR:
  2887.     case ROUND_DIV_EXPR:
  2888.     case EXACT_DIV_EXPR:
  2889.       preexpand_calls (exp);
  2890.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2891.       /* Possible optimization: compute the dividend with EXPAND_SUM
  2892.      then if the divisor is constant can optimize the case
  2893.      where some terms of the dividend have coeffs divisible by it.  */
  2894.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2895.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2896.       return expand_divmod (0, code, mode, op0, op1, target,
  2897.                 TREE_UNSIGNED (type));
  2898.  
  2899.     case RDIV_EXPR:
  2900.       preexpand_calls (exp);
  2901.       this_optab = flodiv_optab;
  2902.       goto binop;
  2903.  
  2904.     case TRUNC_MOD_EXPR:
  2905.     case FLOOR_MOD_EXPR:
  2906.     case CEIL_MOD_EXPR:
  2907.     case ROUND_MOD_EXPR:
  2908.       preexpand_calls (exp);
  2909.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  2910.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2911.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  2912.       return expand_divmod (1, code, mode, op0, op1, target,
  2913.                 TREE_UNSIGNED (type));
  2914. #if 0
  2915. #ifdef HAVE_divmoddisi4
  2916.       if (GET_MODE (op0) != DImode)
  2917.     {
  2918.       temp = gen_reg_rtx (DImode);
  2919.       convert_move (temp, op0, 0);
  2920.       op0 = temp;
  2921.       if (GET_MODE (op1) != SImode && GET_CODE (op1) != CONST_INT)
  2922.         {
  2923.           temp = gen_reg_rtx (SImode);
  2924.           convert_move (temp, op1, 0);
  2925.           op1 = temp;
  2926.         }
  2927.       temp = gen_reg_rtx (SImode);
  2928.       if (target == 0)
  2929.         target = gen_reg_rtx (SImode);
  2930.       emit_insn (gen_divmoddisi4 (temp, protect_from_queue (op0, 0),
  2931.                       protect_from_queue (op1, 0),
  2932.                       protect_from_queue (target, 1)));
  2933.       return target;
  2934.     }
  2935. #endif
  2936. #endif
  2937.  
  2938.     case FIX_ROUND_EXPR:
  2939.     case FIX_FLOOR_EXPR:
  2940.     case FIX_CEIL_EXPR:
  2941.       abort ();            /* Not used for C.  */
  2942.  
  2943.     case FIX_TRUNC_EXPR:
  2944.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  2945.       if (target == 0)
  2946.     target = gen_reg_rtx (mode);
  2947.       {
  2948.     int unsignedp = TREE_UNSIGNED (TREE_TYPE (exp));
  2949.     if (mode == HImode || mode == QImode)
  2950.       {
  2951.         register rtx temp = gen_reg_rtx (SImode);
  2952.         expand_fix (temp, op0, 0);
  2953.         convert_move (target, temp, 0);
  2954.       }
  2955.     else
  2956.       expand_fix (target, op0, unsignedp);
  2957.       }
  2958.       return target;
  2959.  
  2960.     case FLOAT_EXPR:
  2961.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  2962.       if (target == 0)
  2963.     target = gen_reg_rtx (mode);
  2964.       if (GET_MODE (op0) == VOIDmode)
  2965.     /* Avoid problem in convert_move due to unknown mode of OP0.  */
  2966.     op0 = copy_to_mode_reg (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0))),
  2967.                 op0);
  2968.       {
  2969.     int unsignedp = TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)));
  2970.     if (GET_MODE (op0) == HImode
  2971.         || GET_MODE (op0) == QImode)
  2972.       {
  2973.         register rtx temp = gen_reg_rtx (SImode);
  2974.         convert_move (temp, op0, unsignedp);
  2975.         expand_float (target, temp, 0);
  2976.       }
  2977.     else
  2978.       expand_float (target, op0, unsignedp);
  2979.       }
  2980.       return target;
  2981.  
  2982.     case NEGATE_EXPR:
  2983.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  2984.       temp = expand_unop (mode, neg_optab, op0, target, 0);
  2985.       if (temp == 0)
  2986.     abort ();
  2987.       return temp;
  2988.  
  2989.     case ABS_EXPR:
  2990.       /* First try to do it with a special abs instruction.
  2991.      If that does not win, use conditional jump and negate.  */
  2992.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  2993.       temp = expand_unop (mode, abs_optab, op0, target, 0);
  2994.       if (temp != 0)
  2995.     return temp;
  2996.       temp = gen_label_rtx ();
  2997.       if (target == 0 || GET_CODE (target) != REG)
  2998.     target = gen_reg_rtx (mode);
  2999.       emit_move_insn (target, op0);
  3000.       emit_cmp_insn (target,
  3001.              expand_expr (convert (TREE_TYPE (exp), integer_zero_node),
  3002.                   0, VOIDmode, 0),
  3003.              0, 0, 0);
  3004.       NO_DEFER_POP;
  3005.       emit_jump_insn (gen_bge (temp));
  3006.       op0 = expand_unop (mode, neg_optab, target, target, 0);
  3007.       if (op0 != target)
  3008.     emit_move_insn (target, op0);
  3009.       emit_label (temp);
  3010.       OK_DEFER_POP;
  3011.       return target;
  3012.  
  3013.     case MAX_EXPR:
  3014.     case MIN_EXPR:
  3015.       mode = TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 1)));
  3016.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3017.       if (target == 0 || GET_CODE (target) != REG || target == op1)
  3018.     target = gen_reg_rtx (mode);
  3019.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  3020.       if (target != op0)
  3021.     emit_move_insn (target, op0);
  3022.       op0 = gen_label_rtx ();
  3023.       if (code == MAX_EXPR)
  3024.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  3025.         ? compare1 (target, op1, GEU, LEU, 1, mode)
  3026.         : compare1 (target, op1, GE, LE, 0, mode));
  3027.       else
  3028.     temp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1)))
  3029.         ? compare1 (target, op1, LEU, GEU, 1, mode)
  3030.         : compare1 (target, op1, LE, GE, 0, mode));
  3031.       if (temp == const0_rtx)
  3032.     emit_move_insn (target, op1);
  3033.       else if (temp != const1_rtx)
  3034.     {
  3035.       if (bcc_gen_fctn[(int) GET_CODE (temp)] != 0)
  3036.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (temp)]) (op0));
  3037.       else
  3038.         abort ();
  3039.       emit_move_insn (target, op1);
  3040.     }
  3041.       emit_label (op0);
  3042.       return target;
  3043.  
  3044. /* ??? Can optimize when the operand of this is a bitwise operation,
  3045.    by using a different bitwise operation.  */
  3046.     case BIT_NOT_EXPR:
  3047.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3048.       temp = expand_unop (mode, one_cmpl_optab, op0, target, 1);
  3049.       if (temp == 0)
  3050.     abort ();
  3051.       return temp;
  3052.  
  3053.     case FFS_EXPR:
  3054.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3055.       temp = expand_unop (mode, ffs_optab, op0, target, 1);
  3056.       if (temp == 0)
  3057.     abort ();
  3058.       return temp;
  3059.  
  3060. /* ??? Can optimize bitwise operations with one arg constant.
  3061.    Pastel optimizes (a bitwise1 n) bitwise2 (a bitwise3 b)
  3062.    and (a bitwise1 b) bitwise2 b (etc)
  3063.    but that is probably not worth while.  */
  3064.  
  3065. /* BIT_AND_EXPR is for bitwise anding.
  3066.    TRUTH_AND_EXPR is for anding two boolean values
  3067.    when we want in all cases to compute both of them.
  3068.    In general it is fastest to do TRUTH_AND_EXPR by
  3069.    computing both operands as actual zero-or-1 values
  3070.    and then bitwise anding.  In cases where there cannot
  3071.    be any side effects, better code would be made by
  3072.    treating TRUTH_AND_EXPR like TRUTH_ANDIF_EXPR;
  3073.    but the question is how to recognize those cases.  */
  3074.  
  3075.     case TRUTH_AND_EXPR:
  3076.     case BIT_AND_EXPR:
  3077.       preexpand_calls (exp);
  3078.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3079.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3080.       op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3081.       return expand_bit_and (mode, op0, op1, target);
  3082.  
  3083. /* See comment above about TRUTH_AND_EXPR; it applies here too.  */
  3084.     case TRUTH_OR_EXPR:
  3085.     case BIT_IOR_EXPR:
  3086.       preexpand_calls (exp);
  3087.       this_optab = ior_optab;
  3088.       goto binop;
  3089.  
  3090.     case BIT_XOR_EXPR:
  3091.       preexpand_calls (exp);
  3092.       this_optab = xor_optab;
  3093.       goto binop;
  3094.  
  3095.     case LSHIFT_EXPR:
  3096.     case RSHIFT_EXPR:
  3097.     case LROTATE_EXPR:
  3098.     case RROTATE_EXPR:
  3099.       preexpand_calls (exp);
  3100.       subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3101.       op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3102.       return expand_shift (code, mode, op0, TREE_OPERAND (exp, 1), target,
  3103.                TREE_UNSIGNED (type));
  3104.  
  3105. /* ??? cv's were used to effect here to combine additive constants
  3106.    and to determine the answer when only additive constants differ.
  3107.    Also, the addition of one can be handled by changing the condition.  */
  3108.     case LT_EXPR:
  3109.     case LE_EXPR:
  3110.     case GT_EXPR:
  3111.     case GE_EXPR:
  3112.     case EQ_EXPR:
  3113.     case NE_EXPR:
  3114.       preexpand_calls (exp);
  3115.       temp = do_store_flag (exp, target, mode);
  3116.       if (temp != 0)
  3117.     return temp;
  3118.       /* For foo != 0, load foo, and if it is nonzero load 1 instead. */
  3119.       if (code == NE_EXPR && integer_zerop (TREE_OPERAND (exp, 1))
  3120.       && subtarget
  3121.       && (GET_MODE (subtarget)
  3122.           == TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))))
  3123.     {
  3124.       temp = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3125.       if (temp != subtarget)
  3126.         temp = copy_to_reg (temp);
  3127.       op1 = gen_label_rtx ();
  3128.       emit_cmp_insn (temp, const0_rtx, 0, TREE_UNSIGNED (type), 0);
  3129.       emit_jump_insn (gen_beq (op1));
  3130.       emit_move_insn (temp, const1_rtx);
  3131.       emit_label (op1);
  3132.       return temp;
  3133.     }
  3134.       /* If no set-flag instruction, must generate a conditional
  3135.      store into a temporary variable.  Drop through
  3136.      and handle this like && and ||.  */
  3137.  
  3138.     case TRUTH_ANDIF_EXPR:
  3139.     case TRUTH_ORIF_EXPR:
  3140.       temp = gen_reg_rtx (mode);
  3141.       emit_clr_insn (temp);
  3142.       op1 = gen_label_rtx ();
  3143.       jumpifnot (exp, op1);
  3144.       emit_0_to_1_insn (temp);
  3145.       emit_label (op1);
  3146.       return temp;
  3147.  
  3148.     case TRUTH_NOT_EXPR:
  3149.       op0 = expand_expr (TREE_OPERAND (exp, 0), target, VOIDmode, 0);
  3150.       /* The parser is careful to generate TRUTH_NOT_EXPR
  3151.      only with operands that are always zero or one.  */
  3152.       temp = expand_binop (mode, xor_optab, op0,
  3153.                gen_rtx (CONST_INT, mode, 1),
  3154.                target, 1, OPTAB_LIB_WIDEN);
  3155.       if (temp == 0)
  3156.     abort ();
  3157.       return temp;
  3158.  
  3159.     case COMPOUND_EXPR:
  3160.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  3161.       emit_queue ();
  3162.       return expand_expr (TREE_OPERAND (exp, 1), target, VOIDmode, 0);
  3163.  
  3164.     case COND_EXPR:
  3165.       {
  3166.     /* Note that COND_EXPRs whose type is a structure or union
  3167.        are required to be constructed to contain assignments of
  3168.        a temporary variable, so that we can evaluate them here
  3169.        for side effect only.  If type is void, we must do likewise.  */
  3170.  
  3171.     /* If an arm of the branch requires a cleanup, that
  3172.        only that cleanup is performed.  */
  3173.  
  3174.     tree old_cleanups = cleanups_this_call;
  3175.     cleanups_this_call = 0;
  3176.  
  3177.     op0 = gen_label_rtx ();
  3178.     op1 = gen_label_rtx ();
  3179.  
  3180.     if (mode == VOIDmode || ignore)
  3181.       temp = 0;
  3182.     else if (target)
  3183.       temp = target;
  3184.     else if (mode == BLKmode)
  3185.       {
  3186.         if (TYPE_SIZE (type) == 0 || ! TREE_LITERAL (TYPE_SIZE (type)))
  3187.           abort ();
  3188.         temp = assign_stack_local (BLKmode,
  3189.                        (TREE_INT_CST_LOW (TYPE_SIZE (type))
  3190.                     * TYPE_SIZE_UNIT (type)
  3191.                     + BITS_PER_UNIT - 1)
  3192.                        / BITS_PER_UNIT);
  3193.       }
  3194.     else
  3195.       temp = gen_reg_rtx (mode);
  3196.  
  3197.     jumpifnot (TREE_OPERAND (exp, 0), op0);
  3198.     NO_DEFER_POP;
  3199.     if (temp != 0)
  3200.       store_expr (TREE_OPERAND (exp, 1), temp, 0);
  3201.     else
  3202.       expand_expr (TREE_OPERAND (exp, 1), ignore ? const0_rtx : 0,
  3203.                VOIDmode, 0);
  3204.     if (cleanups_this_call)
  3205.       {
  3206.         sorry ("aggreage value in COND_EXPR");
  3207.         cleanups_this_call = 0;
  3208.       }
  3209.  
  3210.     emit_queue ();
  3211.     emit_jump_insn (gen_jump (op1));
  3212.     emit_barrier ();
  3213.     emit_label (op0);
  3214.     if (temp != 0)
  3215.       store_expr (TREE_OPERAND (exp, 2), temp, 0);
  3216.     else
  3217.       expand_expr (TREE_OPERAND (exp, 2), ignore ? const0_rtx : 0,
  3218.                VOIDmode, 0);
  3219.     if (cleanups_this_call)
  3220.       {
  3221.         sorry ("aggreage value in COND_EXPR");
  3222.         cleanups_this_call = 0;
  3223.       }
  3224.  
  3225.     emit_queue ();
  3226.     emit_label (op1);
  3227.     OK_DEFER_POP;
  3228.     cleanups_this_call = old_cleanups;
  3229.     return temp;
  3230.       }
  3231.  
  3232.     case NEW_EXPR:
  3233.       {
  3234.     /* Something needs to be initialized, but we didn't know
  3235.        where that thing was when building the tree.  For example,
  3236.        it could be the return value of a function, or a parameter
  3237.        to a function which lays down in the stack, or a temporary
  3238.        variable which must be passed by reference.  */
  3239.  
  3240.     tree slot = TREE_OPERAND (exp, 0);
  3241.  
  3242.     if (TREE_CODE (slot) != VAR_DECL)
  3243.       abort ();
  3244.  
  3245.     if (target == 0)
  3246.       {
  3247.         target = assign_stack_local (TYPE_MODE (type),
  3248.                      int_size_in_bytes (type));
  3249.  
  3250.         DECL_RTL (slot) = target;
  3251.  
  3252.         /* Since SLOT is not known to the called function
  3253.            to belong to its stack frame, we must build an explicit
  3254.            cleanup.  This case occurs when we must build up a reference
  3255.            to pass the reference as an argument.  In this case,
  3256.            it is very likely that such a reference need not be
  3257.            built here.  */
  3258.  
  3259.         if (TREE_OPERAND (exp, 2) == 0)
  3260.           TREE_OPERAND (exp, 2) = (tree)maybe_build_cleanup (slot);
  3261.         if (TREE_OPERAND (exp, 2))
  3262.           cleanups_this_call = tree_cons (0, TREE_OPERAND (exp, 2),
  3263.                          cleanups_this_call);
  3264.       }
  3265.     else
  3266.       {
  3267.         /* This case does occur, when expanding a parameter which
  3268.            needs to be constructed on the stack.  The target
  3269.            is the actual stack address that we want to initialize.
  3270.  
  3271.            The function we call will perform the cleanup in this case.  */
  3272.         DECL_RTL (slot) = target;
  3273.       }
  3274.  
  3275.     /* Run the initialization expression now with the target.  */
  3276.     return expand_expr (TREE_OPERAND (exp, 1), target, tmode, modifier);
  3277.       }
  3278.  
  3279.     case INIT_EXPR:
  3280.       {
  3281.     tree lhs = TREE_OPERAND (exp, 0);
  3282.     tree rhs = TREE_OPERAND (exp, 1);
  3283.     tree noncopied_parts = 0;
  3284.     tree type = TREE_TYPE (lhs);
  3285.  
  3286.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  3287.     if (TYPE_NONCOPIED_PARTS (type) != 0 && !fixed_type_p (rhs))
  3288.       noncopied_parts = init_noncopied_parts (stabilize_reference (lhs),
  3289.                           TYPE_NONCOPIED_PARTS (type));
  3290.     while (noncopied_parts != 0)
  3291.       {
  3292.         expand_assignment (TREE_VALUE (noncopied_parts),
  3293.                    TREE_PURPOSE (noncopied_parts), 0, 0);
  3294.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  3295.       }
  3296.     return temp;
  3297.       }
  3298.  
  3299.     case MODIFY_EXPR:
  3300.       {
  3301.     /* If lhs is complex, expand calls in rhs before computing it.
  3302.        That's so we don't compute a pointer and save it over a call.
  3303.        If lhs is simple, compute it first so we can give it as a
  3304.        target if the rhs is just a call.  This avoids an extra temp and copy
  3305.        and that prevents a partial-subsumption which makes bad code.
  3306.        Actually we could treat component_ref's of vars like vars.  */
  3307.     tree lhs = TREE_OPERAND (exp, 0);
  3308.     tree rhs = TREE_OPERAND (exp, 1);
  3309.     tree noncopied_parts = 0;
  3310.     tree type = TREE_TYPE (lhs);
  3311.     temp = 0;
  3312.  
  3313.     if (TREE_CODE (lhs) != VAR_DECL
  3314.         && TREE_CODE (lhs) != RESULT_DECL
  3315.         && TREE_CODE (lhs) != PARM_DECL)
  3316.       preexpand_calls (exp);
  3317.  
  3318.     /* Check for |= or &= of a bitfield of size one into another bitfield
  3319.        of size 1.  In this case, (unless we need the result of the
  3320.        assignment) we can do this more efficiently with a
  3321.        test followed by an assignment, if necessary.  */
  3322.     if (ignore
  3323.         && TREE_CODE (lhs) == COMPONENT_REF
  3324.         && (TREE_CODE (rhs) == BIT_IOR_EXPR
  3325.         || TREE_CODE (rhs) == BIT_AND_EXPR)
  3326.         && TREE_OPERAND (rhs, 0) == lhs
  3327.         && TREE_CODE (TREE_OPERAND (rhs, 1)) == COMPONENT_REF
  3328.         && (TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (lhs, 1)))
  3329.         * DECL_SIZE_UNIT (TREE_OPERAND (lhs, 1))) == 1
  3330.         && (TREE_INT_CST_LOW (DECL_SIZE (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1)))
  3331.         * DECL_SIZE_UNIT (TREE_OPERAND (TREE_OPERAND (rhs, 1), 1))) == 1)
  3332.       {
  3333.         rtx label = gen_label_rtx ();
  3334.  
  3335.         do_jump (TREE_OPERAND (rhs, 1),
  3336.              TREE_CODE (rhs) == BIT_IOR_EXPR ? label : 0,
  3337.              TREE_CODE (rhs) == BIT_AND_EXPR ? label : 0);
  3338.         expand_assignment (lhs, convert (TREE_TYPE (rhs),
  3339.                          (TREE_CODE (rhs) == BIT_IOR_EXPR
  3340.                           ? integer_one_node
  3341.                           : integer_zero_node)),
  3342.                    0, 0);
  3343.         emit_label (label);
  3344.         return const0_rtx;
  3345.       }
  3346.  
  3347.     if (TYPE_NONCOPIED_PARTS (type) != 0
  3348.         && ! (fixed_type_p (lhs) && fixed_type_p (rhs)))
  3349.       noncopied_parts = save_noncopied_parts (stabilize_reference (lhs),
  3350.                           TYPE_NONCOPIED_PARTS (type));
  3351.  
  3352.     temp = expand_assignment (lhs, rhs, ! ignore, original_target != 0);
  3353.     while (noncopied_parts != 0)
  3354.       {
  3355.         expand_assignment (TREE_PURPOSE (noncopied_parts),
  3356.                    TREE_VALUE (noncopied_parts), 0, 0);
  3357.         noncopied_parts = TREE_CHAIN (noncopied_parts);
  3358.       }
  3359.     return temp;
  3360.       }
  3361.  
  3362.     case PREINCREMENT_EXPR:
  3363.     case PREDECREMENT_EXPR:
  3364.       return expand_increment (exp, 0);
  3365.  
  3366.     case POSTINCREMENT_EXPR:
  3367.     case POSTDECREMENT_EXPR:
  3368.       return expand_increment (exp, !ignore);
  3369.  
  3370.     case ADDR_EXPR:
  3371.       op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode,
  3372.              modifier != EXPAND_INTO_STACK ? EXPAND_CONST_ADDRESS : EXPAND_INTO_STACK);
  3373.       if (GET_CODE (op0) != MEM)
  3374.     abort ();
  3375.       if (modifier == EXPAND_SUM)
  3376.     return XEXP (op0, 0);
  3377.       op0 = force_operand (XEXP (op0, 0), target);
  3378.       if (flag_force_addr && GET_CODE (op0) != REG)
  3379.     return force_reg (Pmode, op0);
  3380.       return op0;
  3381.  
  3382.     case ENTRY_VALUE_EXPR:
  3383.       abort ();
  3384.  
  3385.     case ERROR_MARK:
  3386.       return const0_rtx;
  3387.  
  3388.     default:
  3389.       return (*lang_expand_expr) (exp, target, tmode, modifier);
  3390.     }
  3391.  
  3392.   /* Here to do an ordinary binary operator, generating an instruction
  3393.      from the optab already placed in `this_optab'.  */
  3394.  binop:
  3395.   /* Detect things like x = y | (a == b)
  3396.      and do them as (x = y), (a == b ? x |= 1 : 0), x.  */
  3397.   /* First, get the comparison or conditional into the second arg.  */
  3398.   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 0))]
  3399.       || (TREE_CODE (TREE_OPERAND (exp, 0)) == COND_EXPR
  3400.       && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 1))
  3401.           || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 0), 2)))))
  3402.     {
  3403.       if (this_optab == ior_optab || this_optab == add_optab
  3404.       || this_optab == xor_optab)
  3405.     {
  3406.       tree exch = TREE_OPERAND (exp, 1);
  3407.       TREE_OPERAND (exp, 1) = TREE_OPERAND (exp, 0);
  3408.       TREE_OPERAND (exp, 0) = exch;
  3409.     }
  3410.     }
  3411.   /* Optimize X + (Y ? Z : 0) by computing X and maybe adding Z.  */
  3412.   if (comparison_code[(int) TREE_CODE (TREE_OPERAND (exp, 1))]
  3413.       || (TREE_CODE (TREE_OPERAND (exp, 1)) == COND_EXPR
  3414.       && (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 1))
  3415.           || integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))))
  3416.     {
  3417.       if (this_optab == ior_optab || this_optab == add_optab
  3418.       || this_optab == xor_optab || this_optab == sub_optab
  3419.       || this_optab == lshl_optab || this_optab == ashl_optab
  3420.       || this_optab == lshr_optab || this_optab == ashr_optab
  3421.       || this_optab == rotl_optab || this_optab == rotr_optab)
  3422.     {
  3423.       tree thenexp;
  3424.       rtx thenv = 0;
  3425.  
  3426.       /* TARGET gets a reg in which we can perform the computation.
  3427.          Use the specified target if it's a pseudo reg and safe.  */
  3428.       target = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3429.       if (target == 0) target = gen_reg_rtx (mode);
  3430.  
  3431.       /* Compute X into the target.  */
  3432.       store_expr (TREE_OPERAND (exp, 0), target, 0);
  3433.       op0 = gen_label_rtx ();
  3434.  
  3435.       /* If other operand is a comparison COMP, treat it as COMP ? 1 : 0 */
  3436.       if (TREE_CODE (TREE_OPERAND (exp, 1)) != COND_EXPR)
  3437.         {
  3438.           do_jump (TREE_OPERAND (exp, 1), op0, 0);
  3439.           thenv = const1_rtx;
  3440.         }
  3441.       else if (integer_zerop (TREE_OPERAND (TREE_OPERAND (exp, 1), 2)))
  3442.         {
  3443.           do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), op0, 0);
  3444.           thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 1);
  3445.         }
  3446.       else
  3447.         {
  3448.           do_jump (TREE_OPERAND (TREE_OPERAND (exp, 1), 0), 0, op0);
  3449.           thenexp = TREE_OPERAND (TREE_OPERAND (exp, 1), 2);
  3450.         }
  3451.  
  3452.       if (thenv == 0)
  3453.         thenv = expand_expr (thenexp, 0, VOIDmode, 0);
  3454.  
  3455.       /* THENV is now Z, the value to operate on, as an rtx.
  3456.          We have already tested that Y isn't zero, so do the operation.  */
  3457.  
  3458.       if (this_optab == rotl_optab || this_optab == rotr_optab)
  3459.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3460.                  -1, OPTAB_LIB);
  3461.       else if (this_optab == lshl_optab || this_optab == lshr_optab)
  3462.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3463.                  1, OPTAB_LIB_WIDEN);
  3464.       else
  3465.         temp = expand_binop (mode, this_optab, target, thenv, target,
  3466.                  0, OPTAB_LIB_WIDEN);
  3467.       if (target != temp)
  3468.         emit_move_insn (target, temp);
  3469.  
  3470.       emit_queue ();
  3471.       do_pending_stack_adjust ();
  3472.       emit_label (op0);
  3473.       return target;
  3474.     }
  3475.     }
  3476.   subtarget = validate_subtarget (subtarget, TREE_OPERAND (exp, 1));
  3477.   op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
  3478.   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3479.  binop2:
  3480.   temp = expand_binop (mode, this_optab, op0, op1, target,
  3481.                TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  3482.   if (temp == 0)
  3483.     abort ();
  3484.   return temp;
  3485. }
  3486.  
  3487. /* Expand an expression EXP that calls a built-in function,
  3488.    with result going to TARGET if that's convenient
  3489.    (and in mode MODE if that's convenient).
  3490.    SUBTARGET may be used as the target for computing one of EXP's operands.
  3491.    IGNORE is nonzero if the value is to be ignored.  */
  3492.  
  3493. static rtx
  3494. expand_builtin (exp, target, subtarget, mode, ignore)
  3495.      tree exp;
  3496.      rtx target;
  3497.      rtx subtarget;
  3498.      enum machine_mode mode;
  3499.      int ignore;
  3500. {
  3501.   tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
  3502.   tree arglist = TREE_OPERAND (exp, 1);
  3503.   rtx op0;
  3504.  
  3505.   switch (DECL_FUNCTION_CODE (fndecl))
  3506.     {
  3507.     case BUILT_IN_ABS:
  3508.     case BUILT_IN_LABS:
  3509.     case BUILT_IN_FABS:
  3510.       /* build_function_call changes these into ABS_EXPR.  */
  3511.       abort ();
  3512.  
  3513.     case BUILT_IN_SAVEREGS:
  3514.       {
  3515.     /* When this function is called, it means that registers must be
  3516.        saved on entry to this function.  So we migrate the
  3517.        call to the first insn of this function.  */
  3518.     rtx last = get_last_insn ();
  3519.     rtx temp, saving_insns, last_saving_insn;
  3520.  
  3521.     /* If there are parameters which must be saved from this function,
  3522.        save them now.  */
  3523.     saving_insns = save_from_saveregs;
  3524.     emit_insns (saving_insns);
  3525.     if (saving_insns)
  3526.       {
  3527.         emit_note (0, -1);
  3528.         last_saving_insn = get_last_insn ();
  3529.       }
  3530.  
  3531.     /* Now really call the function.  `expand_call' does not call
  3532.        expand_builtin, so there is no danger of infinite recursion here.  */
  3533.     temp = expand_call (exp, target, ignore);
  3534.  
  3535.     if (saving_insns)
  3536.       {
  3537.         extern void use_variable ();
  3538.         do
  3539.           {
  3540.         if (GET_CODE (saving_insns) == INSN)
  3541.           note_stores (PATTERN (saving_insns), use_variable);
  3542.         saving_insns = NEXT_INSN (saving_insns);
  3543.           } while (saving_insns != last_saving_insn);
  3544.       }
  3545.     reorder_insns (NEXT_INSN (last), get_last_insn (), get_insns ());
  3546.     return temp;
  3547.       }
  3548.  
  3549.     case BUILT_IN_CLASSIFY_TYPE:
  3550.       if (arglist != 0)
  3551.     {
  3552.       tree type = TREE_TYPE (TREE_VALUE (arglist));
  3553.       enum tree_code code = TREE_CODE (type);
  3554.       if (code == VOID_TYPE)
  3555.         return gen_rtx (CONST_INT, VOIDmode, void_type_class);
  3556.       if (code == INTEGER_TYPE)
  3557.         return gen_rtx (CONST_INT, VOIDmode, integer_type_class);
  3558.       if (code == CHAR_TYPE)
  3559.         return gen_rtx (CONST_INT, VOIDmode, char_type_class);
  3560.       if (code == ENUMERAL_TYPE)
  3561.         return gen_rtx (CONST_INT, VOIDmode, enumeral_type_class);
  3562.       if (code == BOOLEAN_TYPE)
  3563.         return gen_rtx (CONST_INT, VOIDmode, boolean_type_class);
  3564.       if (code == POINTER_TYPE)
  3565.         return gen_rtx (CONST_INT, VOIDmode, pointer_type_class);
  3566.       if (code == REFERENCE_TYPE)
  3567.         return gen_rtx (CONST_INT, VOIDmode, reference_type_class);
  3568.       if (code == OFFSET_TYPE)
  3569.         return gen_rtx (CONST_INT, VOIDmode, offset_type_class);
  3570.       if (code == REAL_TYPE)
  3571.         return gen_rtx (CONST_INT, VOIDmode, real_type_class);
  3572.       if (code == COMPLEX_TYPE)
  3573.         return gen_rtx (CONST_INT, VOIDmode, complex_type_class);
  3574.       if (code == FUNCTION_TYPE)
  3575.         return gen_rtx (CONST_INT, VOIDmode, function_type_class);
  3576.       if (code == METHOD_TYPE)
  3577.         return gen_rtx (CONST_INT, VOIDmode, method_type_class);
  3578.       if (code == RECORD_TYPE)
  3579.         return gen_rtx (CONST_INT, VOIDmode, record_type_class);
  3580.       if (code == UNION_TYPE)
  3581.         return gen_rtx (CONST_INT, VOIDmode, union_type_class);
  3582.       if (code == ARRAY_TYPE)
  3583.         return gen_rtx (CONST_INT, VOIDmode, array_type_class);
  3584.       if (code == STRING_TYPE)
  3585.         return gen_rtx (CONST_INT, VOIDmode, string_type_class);
  3586.       if (code == SET_TYPE)
  3587.         return gen_rtx (CONST_INT, VOIDmode, set_type_class);
  3588.       if (code == FILE_TYPE)
  3589.         return gen_rtx (CONST_INT, VOIDmode, file_type_class);
  3590.       if (code == LANG_TYPE)
  3591.         return gen_rtx (CONST_INT, VOIDmode, lang_type_class);
  3592.     }
  3593.       return gen_rtx (CONST_INT, VOIDmode, no_type_class);
  3594.  
  3595.     case BUILT_IN_ALLOCA:
  3596.       if (arglist == 0
  3597.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  3598.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  3599.     return const0_rtx;
  3600.       frame_pointer_needed = 1;
  3601.       current_function_calls_alloca = 1;
  3602.       /* Compute the argument.  */
  3603.       op0 = expand_expr (TREE_VALUE (arglist), 0, VOIDmode, 0);
  3604.       if (! CONSTANT_P (op0))
  3605.     {
  3606.       op0 = force_reg (GET_MODE (op0), op0);
  3607.       if (GET_MODE (op0) != Pmode)
  3608.         op0 = convert_to_mode (Pmode, op0, 1);
  3609.     }
  3610.       /* Push that much space (rounding it up).  */
  3611.       do_pending_stack_adjust ();
  3612.  
  3613. #ifdef STACK_POINTER_OFFSET
  3614.       /* If we will have to round the result down (which is up
  3615.      if stack grows down), make sure we have extra space so the
  3616.      user still gets at least as much space as he asked for.  */
  3617.       if ((STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES
  3618.       != STACK_POINTER_OFFSET / STACK_BYTES)
  3619.     op0 = plus_constant (op0, STACK_BYTES);
  3620. #endif
  3621.  
  3622. #ifdef STACK_GROWS_DOWNWARD
  3623.       anti_adjust_stack (round_push (op0));
  3624. #endif
  3625.       /* Return a copy of current stack ptr, in TARGET if possible.  */
  3626.       if (target)
  3627.     emit_move_insn (target, stack_pointer_rtx);
  3628.       else
  3629.     target = copy_to_reg (stack_pointer_rtx);
  3630. #ifdef STACK_POINTER_OFFSET
  3631.       /* If the contents of the stack pointer reg are offset from the
  3632.      actual top-of-stack address, add the offset here.  */
  3633.       if (GET_CODE (target) == REG)
  3634.     emit_insn (gen_add2_insn (target,
  3635.                   gen_rtx (CONST_INT, VOIDmode,
  3636.                        (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES)));
  3637.       else
  3638.     {
  3639.       rtx temp =
  3640.         expand_binop (GET_MODE (target), add_optab, target,
  3641.               gen_rtx (CONST_INT, VOIDmode,
  3642.                    (STACK_POINTER_OFFSET + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES),
  3643.               target,
  3644.               1, OPTAB_DIRECT);
  3645.       if (temp == 0) abort ();
  3646.       if (temp != target)
  3647.         emit_move_insn (target, temp);
  3648.     }
  3649. #endif
  3650. #ifndef STACK_GROWS_DOWNWARD
  3651.       anti_adjust_stack (round_push (op0));
  3652. #endif
  3653.       /* Some systems require a particular insn to refer to the stack
  3654.      to make the pages exist.  */
  3655. #ifdef HAVE_probe
  3656.       if (HAVE_probe)
  3657.     emit_insn (gen_probe ());
  3658. #endif
  3659.       return target;
  3660.  
  3661.     case BUILT_IN_FFS:
  3662.       if (arglist == 0
  3663.       /* Arg could be non-integer if user redeclared this fcn wrong.  */
  3664.       || TREE_CODE (TREE_TYPE (TREE_VALUE (arglist))) != INTEGER_TYPE)
  3665.     return const0_rtx;
  3666.  
  3667.       /* Compute the argument.  */
  3668.       op0 = expand_expr (TREE_VALUE (arglist), subtarget, VOIDmode, 0);
  3669.       /* Compute ffs, into TARGET if possible.
  3670.      Set TARGET to wherever the result comes back.  */
  3671.       target = expand_unop (mode, ffs_optab, op0, target, 1);
  3672.       if (target == 0)
  3673.     abort ();
  3674.       return target;
  3675.  
  3676.     default:
  3677.       abort ();
  3678.     }
  3679. }
  3680.  
  3681. /* Expand code for a post- or pre- increment or decrement
  3682.    and return the RTX for the result.
  3683.    POST is 1 for postinc/decrements and 0 for preinc/decrements.  */
  3684.  
  3685. static rtx
  3686. expand_increment (exp, post)
  3687.      register tree exp;
  3688.      int post;
  3689. {
  3690.   register rtx op0, op1;
  3691.   register rtx temp;
  3692.   register tree incremented = TREE_OPERAND (exp, 0);
  3693.   optab this_optab = add_optab;
  3694.   int icode;
  3695.   enum machine_mode mode = TYPE_MODE (TREE_TYPE (exp));
  3696.   int op0_is_copy = 0;
  3697.  
  3698.   /* Stabilize any component ref that might need to be
  3699.      evaluated more than once below.  */
  3700.   if (TREE_CODE (incremented) == COMPONENT_REF
  3701.       && (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
  3702.       || DECL_MODE (TREE_OPERAND (incremented, 1)) == BImode))
  3703.     incremented = stabilize_reference (incremented);
  3704.  
  3705.   /* Compute the operands as RTX.
  3706.      Note whether OP0 is the actual lvalue or a copy of it:
  3707.      I believe it is a copy iff it is a register and insns were
  3708.      generated in computing it.  */
  3709.   temp = get_last_insn ();
  3710.   op0 = expand_expr (incremented, 0, VOIDmode, 0);
  3711.   if (temp != get_last_insn ())
  3712.     op0_is_copy = (GET_CODE (op0) == REG || GET_CODE (op0) == SUBREG);
  3713.   op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  3714.  
  3715.   /* Decide whether incrementing or decrementing.  */
  3716.   if (TREE_CODE (exp) == POSTDECREMENT_EXPR
  3717.       || TREE_CODE (exp) == PREDECREMENT_EXPR)
  3718.     this_optab = sub_optab;
  3719.  
  3720.   /* If OP0 is not the actual lvalue, but rather a copy in a register,
  3721.      then we cannot just increment OP0.  We must
  3722.      therefore contrive to increment the original value.
  3723.      Then we can return OP0 since it is a copy of the old value.  */
  3724.   if (op0_is_copy)
  3725.     {
  3726.       /* This is the easiest way to increment the value wherever it is.
  3727.      Problems with multiple evaluation of INCREMENTED
  3728.      are prevented because either (1) it is a component_ref,
  3729.      in which case it was stabilized above, or (2) it is an array_ref
  3730.      with constant index in an array in a register, which is
  3731.      safe to reevaluate.  */
  3732.       tree newexp = build ((this_optab == add_optab
  3733.                 ? PLUS_EXPR : MINUS_EXPR),
  3734.                TREE_TYPE (exp),
  3735.                incremented,
  3736.                TREE_OPERAND (exp, 1));
  3737.       temp = expand_assignment (incremented, newexp, ! post, 0);
  3738.       return post ? op0 : temp;
  3739.     }
  3740.  
  3741.   /* Convert decrement by a constant into a negative increment.  */
  3742.   if (this_optab == sub_optab
  3743.       && GET_CODE (op1) == CONST_INT)
  3744.     {
  3745.       op1 = gen_rtx (CONST_INT, VOIDmode, - INTVAL (op1));
  3746.       this_optab = add_optab;
  3747.     }
  3748.  
  3749.   if (post)
  3750.     {
  3751.       /* We have a true reference to the value in OP0.
  3752.      If there is an insn to add or subtract in this mode, queue it.  */
  3753.  
  3754.       /* I'm not sure this is still necessary.  */
  3755.       op0 = stabilize (op0);
  3756.  
  3757.       icode = (int) this_optab->handlers[(int) mode].insn_code;
  3758.       if (icode != (int) CODE_FOR_nothing
  3759.       /* Make sure that OP0 is valid for operands 0 and 1
  3760.          of the insn we want to queue.  */
  3761.       && (*insn_operand_predicate[icode][0]) (op0, mode)
  3762.       && (*insn_operand_predicate[icode][1]) (op0, mode))
  3763.     {
  3764.       if (! (*insn_operand_predicate[icode][2]) (op1, mode))
  3765.         op1 = force_reg (mode, op1);
  3766.  
  3767.       return enqueue_insn (op0, GEN_FCN (icode) (op0, op0, op1));
  3768.     }
  3769.     }
  3770.  
  3771.   /* Preincrement, or we can't increment with one simple insn.  */
  3772.   if (post)
  3773.     /* Save a copy of the value before inc or dec, to return it later.  */
  3774.     temp = copy_to_reg (op0);
  3775.   else
  3776.     /* Arrange to return the incremented value.  */
  3777.     /* Copy the rtx because expand_binop will protect from the queue,
  3778.        and the results of that would be invalid for us to return
  3779.        if our caller does emit_queue before using our result.  */
  3780.     temp = copy_rtx (op0);
  3781.  
  3782.   /* Increment however we can.  */
  3783.   op1 = expand_binop (mode, this_optab, op0, op1, op0,
  3784.               TREE_UNSIGNED (TREE_TYPE (exp)), OPTAB_LIB_WIDEN);
  3785.   /* Make sure the value is stored into OP0.  */
  3786.   if (op1 != op0)
  3787.     emit_move_insn (op0, op1);
  3788.  
  3789.   return temp;
  3790. }
  3791.  
  3792. /* Expand all function calls contained within EXP, innermost ones first.
  3793.    But don't look within expressions that have sequence points.
  3794.    For each CALL_EXPR, record the rtx for its value
  3795.    in the CALL_EXPR_RTL field.
  3796.  
  3797.    Calls that return large structures for which a structure return
  3798.    stack slot is needed are not preexpanded.  Preexpanding them loses
  3799.    because if more than one were preexpanded they would try to use the
  3800.    same stack slot.  */
  3801.  
  3802. static void
  3803. preexpand_calls (exp)
  3804.      tree exp;
  3805. {
  3806.   register int nops, i;
  3807.  
  3808.   if (! do_preexpand_calls)
  3809.     return;
  3810.  
  3811.   /* Only expressions and references can contain calls.  */
  3812.  
  3813.   if (tree_code_type[(int) TREE_CODE (exp)][0] != 'e'
  3814.       && tree_code_type[(int) TREE_CODE (exp)][0] != 'r')
  3815.     return;
  3816.  
  3817.   switch (TREE_CODE (exp))
  3818.     {
  3819.     case CALL_EXPR:
  3820.       /* Do nothing to built-in functions.  */
  3821.       if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
  3822.       && TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0)) == FUNCTION_DECL
  3823.       && (DECL_FUNCTION_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
  3824.           != NOT_BUILT_IN))
  3825.     return;
  3826.       /* Precompute calls that don't return values in memory.  */
  3827.       if (CALL_EXPR_RTL (exp) == 0
  3828.       && TYPE_MODE (TREE_TYPE (exp)) != BLKmode
  3829.       && ! RETURN_IN_MEMORY (TREE_TYPE (exp)))
  3830.     CALL_EXPR_RTL (exp) = expand_call (exp, 0, 0, 0);
  3831.       return;
  3832.  
  3833.     case COMPOUND_EXPR:
  3834.     case COND_EXPR:
  3835.     case TRUTH_ANDIF_EXPR:
  3836.     case TRUTH_ORIF_EXPR:
  3837.       /* If we find one of these, then we can be sure
  3838.      the adjust will be done for it (since it makes jumps).
  3839.      Do it now, so that if this is inside an argument
  3840.      of a function, we don't get the stack adjustment
  3841.      after some other args have already been pushed.  */
  3842.       do_pending_stack_adjust ();
  3843.       return;
  3844.  
  3845.     case RTL_EXPR:
  3846.       return;
  3847.  
  3848.     case SAVE_EXPR:
  3849.       if (SAVE_EXPR_RTL (exp) != 0)
  3850.     return;
  3851.     }
  3852.  
  3853.   nops = tree_code_length[(int) TREE_CODE (exp)];
  3854.   for (i = 0; i < nops; i++)
  3855.     if (TREE_OPERAND (exp, i) != 0)
  3856.       {
  3857.     register int type = *tree_code_type[(int) TREE_CODE (TREE_OPERAND (exp, i))];
  3858.     if (type == 'e' || type == 'r')
  3859.       preexpand_calls (TREE_OPERAND (exp, i));
  3860.       }
  3861. }
  3862.  
  3863. /* Force FUNEXP into a form suitable for the address of a CALL,
  3864.    and return that as an rtx.  Also load the static chain register
  3865.    from either FUNEXP or CONTEXT.  */
  3866.  
  3867. static rtx
  3868. prepare_call_address (funexp, context)
  3869.      rtx funexp;
  3870.      rtx context;
  3871. {
  3872.   funexp = protect_from_queue (funexp, 0);
  3873.   if (context != 0)
  3874.     context = protect_from_queue (context, 0);
  3875.  
  3876.   /* Function variable in language with nested functions.  */
  3877.   if (GET_MODE (funexp) == EPmode)
  3878.     {
  3879.       emit_move_insn (static_chain_rtx, gen_highpart (Pmode, funexp));
  3880.       funexp = memory_address (FUNCTION_MODE, gen_lowpart (Pmode, funexp));
  3881.       emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
  3882.     }
  3883.   else
  3884.     {
  3885.       if (context != 0)
  3886.     /* Unless function variable in C, or top level function constant */
  3887.     emit_move_insn (static_chain_rtx, lookup_static_chain (context));
  3888.  
  3889.       /* Make a valid memory address and copy constants thru pseudo-regs,
  3890.      but not for a constant address if -fno-function-cse.  */
  3891.       if (GET_CODE (funexp) != SYMBOL_REF)
  3892.     funexp = memory_address (FUNCTION_MODE, funexp);
  3893.       else
  3894.     {
  3895. #ifndef NO_FUNCTION_CSE
  3896.       if (optimize && ! flag_no_function_cse)
  3897.         funexp = force_reg (Pmode, funexp);
  3898. #endif
  3899.     }
  3900.  
  3901.       if (context != 0)
  3902.     emit_insn (gen_rtx (USE, VOIDmode, static_chain_rtx));
  3903.     }
  3904.   return funexp;
  3905. }
  3906.  
  3907. /* Generate instructions to call function FUNEXP,
  3908.    and optionally pop the results.
  3909.    The CALL_INSN is the first insn generated.
  3910.  
  3911.    FUNTYPE is the data type of the function, or, for a library call,
  3912.    the identifier for the name of the call.  This is given to the
  3913.    macro RETURN_POPS_ARGS to determine whether this function pops its own args.
  3914.  
  3915.    STACK_SIZE is the number of bytes of arguments on the stack,
  3916.    rounded up to STACK_BOUNDARY; zero if the size is variable.
  3917.    This is both to put into the call insn and
  3918.    to generate explicit popping code if necessary.
  3919.  
  3920.    NEXT_ARG_REG is the rtx that results from executing
  3921.      FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1)
  3922.    just after all the args have had their registers assigned.
  3923.    This could be whatever you like, but normally it is the first
  3924.    arg-register beyond those used for args in this call,
  3925.    or 0 if all the arg-registers are used in this call.
  3926.    It is passed on to `gen_call' so you can put this info in the call insn.
  3927.  
  3928.    VALREG is a hard register in which a value is returned,
  3929.    or 0 if the call does not return a value.
  3930.  
  3931.    OLD_INHIBIT_DEFER_POP is the value that `inhibit_defer_pop' had before
  3932.    the args to this call were processed.
  3933.    We restore `inhibit_defer_pop' to that value.
  3934.  
  3935.    USE_INSNS is a SEQUENCE of USE insns to be emitted immediately before
  3936.    the actual CALL insn.  */
  3937.  
  3938. static void
  3939. emit_call_1 (funexp, funtype, stack_size, next_arg_reg, valreg, old_inhibit_defer_pop, use_insns)
  3940.      rtx funexp;
  3941.      tree funtype;
  3942.      int stack_size;
  3943.      rtx next_arg_reg;
  3944.      rtx valreg;
  3945.      int old_inhibit_defer_pop;
  3946.      rtx use_insns;
  3947. {
  3948.   rtx stack_size_rtx = gen_rtx (CONST_INT, VOIDmode, stack_size);
  3949.   rtx call_insn;
  3950.  
  3951.   if (valreg)
  3952.     emit_call_insn (gen_call_value (valreg,
  3953.                     gen_rtx (MEM, FUNCTION_MODE, funexp),
  3954.                     stack_size_rtx, next_arg_reg));
  3955.   else
  3956.     emit_call_insn (gen_call (gen_rtx (MEM, FUNCTION_MODE, funexp),
  3957.                   stack_size_rtx, next_arg_reg));
  3958.  
  3959.   /* Find the CALL insn we just emitted and write the USE insns before it.  */
  3960.   for (call_insn = get_last_insn();
  3961.        call_insn && GET_CODE (call_insn) != CALL_INSN;
  3962.        call_insn = PREV_INSN (call_insn))
  3963.     ;
  3964.  
  3965.   if (! call_insn)
  3966.     abort ();
  3967.  
  3968.   /* Put the USE insns before the CALL.  */
  3969.   emit_insn_before (use_insns, call_insn);
  3970.  
  3971.   inhibit_defer_pop = old_inhibit_defer_pop;
  3972.  
  3973.   /* If returning from the subroutine does not automatically pop the args,
  3974.      we need an instruction to pop them sooner or later.
  3975.      Perhaps do it now; perhaps just record how much space to pop later.  */
  3976.  
  3977.   if (! RETURN_POPS_ARGS (TREE_TYPE (funtype))
  3978.       && stack_size != 0)
  3979.     {
  3980.       if (flag_defer_pop && inhibit_defer_pop == 0)
  3981.     pending_stack_adjust += stack_size;
  3982.       else
  3983.     adjust_stack (stack_size_rtx);
  3984.     }
  3985. }
  3986.  
  3987. /* At the start of a function, record that we have no previously-pushed
  3988.    arguments waiting to be popped.  */
  3989.  
  3990. void
  3991. init_pending_stack_adjust ()
  3992. {
  3993.   pending_stack_adjust = 0;
  3994. }
  3995.  
  3996. /* When exiting from function, if safe, clear out any pending stack adjust
  3997.    so the adjustment won't get done.  */
  3998.  
  3999. void
  4000. clear_pending_stack_adjust ()
  4001. {
  4002. #ifdef EXIT_IGNORE_STACK
  4003.   if (!flag_omit_frame_pointer && EXIT_IGNORE_STACK
  4004.       && ! TREE_INLINE (current_function_decl)
  4005.       && ! flag_inline_functions)
  4006.     pending_stack_adjust = 0;
  4007. #endif
  4008. }
  4009.  
  4010. /* Pop any previously-pushed arguments that have not been popped yet.  */
  4011.  
  4012. void
  4013. do_pending_stack_adjust ()
  4014. {
  4015.   if (inhibit_defer_pop == 0)
  4016.     {
  4017.       if (pending_stack_adjust != 0)
  4018.     adjust_stack (gen_rtx (CONST_INT, VOIDmode, pending_stack_adjust));
  4019.       pending_stack_adjust = 0;
  4020.     }
  4021. }
  4022.  
  4023. /* Expand all cleanups up to OLD_CLEANUPS.
  4024.    Needed here, and also for language-dependent calls.  */
  4025. void
  4026. expand_cleanups_to (old_cleanups)
  4027.      tree old_cleanups;
  4028. {
  4029.   while (cleanups_this_call != old_cleanups)
  4030.     {
  4031.       expand_expr (TREE_VALUE (cleanups_this_call), 0, VOIDmode, 0);
  4032.       cleanups_this_call = TREE_CHAIN (cleanups_this_call);
  4033.     }
  4034. }
  4035.  
  4036. /* Data structure and subroutines used within expand_call.  */
  4037.  
  4038. struct arg_data
  4039. {
  4040.   /* Tree node for this argument.  */
  4041.   tree tree_value;
  4042.   /* Precomputed RTL value, or 0 if it isn't precomputed.  */
  4043.   rtx value;
  4044.   /* Register to pass this argument in, or 0 if passed on stack.  */
  4045.   rtx reg;
  4046.   /* Number of registers to use.  0 means put the whole arg in registers.
  4047.      Also 0 if not passed in registers.  */
  4048.   int partial;
  4049.   /* Offset of this argument from beginning of stack-args.  */
  4050.   struct args_size offset;
  4051.   /* Size of this argument on the stack, rounded up for any padding it gets,
  4052.      parts of the argument passed in registers do not count.
  4053.      If the FIRST_PARM_CALLER_OFFSET is negative, then register parms
  4054.      are counted here as well.  */
  4055.   struct args_size size;
  4056.   /* Nonzero if this arg has already been stored.  */
  4057.   int stored;
  4058.   /* const0_rtx means should preallocate stack space for this arg.
  4059.      Other non0 value is the stack slot, preallocated.
  4060.      Used only for BLKmode.  */
  4061.   rtx stack;
  4062. };
  4063.  
  4064. static void store_one_arg ();
  4065. static rtx target_for_arg ();
  4066.  
  4067. /* Generate all the code for a function call
  4068.    and return an rtx for its value.
  4069.    Store the value in TARGET (specified as an rtx) if convenient.
  4070.    If the value is stored in TARGET then TARGET is returned.
  4071.    If IGNORE is nonzero, then we ignore the value of the function call.  */
  4072.  
  4073. static rtx
  4074. expand_call (exp, target, ignore, modifier)
  4075.      tree exp;
  4076.      rtx target;
  4077.      int ignore;
  4078.      enum expand_modifier modifier;
  4079. {
  4080.   /* List of actual parameters.  */
  4081.   tree actparms = TREE_OPERAND (exp, 1);
  4082.   /* RTX for the function to be called.  */
  4083.   rtx funexp;
  4084.   /* Data type of the function.  */
  4085.   tree funtype;
  4086.   /* Declaration of the function being called,
  4087.      or 0 if the function is computed (not known by name).  */
  4088.   tree fndecl = 0;
  4089.  
  4090.   /* Register in which non-BLKmode value will be returned,
  4091.      or 0 if no value or if value is BLKmode.  */
  4092.   rtx valreg;
  4093.   /* Address where we should return a BLKmode value;
  4094.      0 if value not BLKmode.  */
  4095.   rtx structure_value_addr = 0;
  4096.   /* Nonzero if that address is being passed by treating it as
  4097.      an extra, implicit first parameter.  Otherwise,
  4098.      it is passed by being copied directly into struct_value_rtx.  */
  4099.   int structure_value_addr_parm = 0;
  4100.   /* Nonzero if called function returns an aggregate in memory PCC style,
  4101.      by returning the address of where to find it.  */
  4102.   int pcc_struct_value = 0;
  4103.  
  4104.   /* Number of actual parameters in this call, including struct value addr.  */
  4105.   int num_actuals;
  4106.   /* Number of named args.  Args after this are anonymous ones
  4107.      and they must all go on the stack.  */
  4108.   int n_named_args;
  4109.  
  4110.   /* Vector of information about each argument.
  4111.      Arguments are numbered in the order they will be pushed,
  4112.      not the order they are written.  */
  4113.   struct arg_data *args;
  4114.  
  4115.   /* Total size in bytes of all the stack-parms scanned so far.  */
  4116.   struct args_size args_size;
  4117.   /* Remember initial value of args_size.constant.  */
  4118.   int starting_args_size;
  4119.   /* Nonzero means count reg-parms' size in ARGS_SIZE.  */
  4120.   int stack_count_regparms = 0;
  4121.   /* Data on reg parms scanned so far.  */
  4122.   CUMULATIVE_ARGS args_so_far;
  4123.   /* Nonzero if a reg parm has been scanned.  */
  4124.   int reg_parm_seen;
  4125.   /* Nonzero if we must avoid push-insns in the args for this call.  */
  4126.   int must_preallocate;
  4127.   /* 1 if scanning parms front to back, -1 if scanning back to front.  */
  4128.   int inc;
  4129.   /* Address of space preallocated for stack parms
  4130.      (on machines that lack push insns), or 0 if space not preallocated.  */
  4131.   rtx argblock = 0;
  4132.  
  4133.   /* Nonzero if it is plausible that this is a call to alloca.  */
  4134.   int may_be_alloca;
  4135.   /* Nonzero if this is a call to setjmp or a related function.  */
  4136.   int is_setjmp;
  4137.   /* Nonzero if this is a call to an inline function.  */
  4138.   int is_integrable = 0;
  4139.   /* Nonzero if this is a call to __builtin_new.  */
  4140.   int is_builtin_new;
  4141.   /* Nonzero if this is a call to a `const' function.  */
  4142.   int is_const = 0;
  4143.  
  4144.   /* Nonzero if there are BLKmode args whose data types require them
  4145.      to be passed in memory, not (even partially) in registers.  */
  4146.   int BLKmode_parms_forced = 0;
  4147.   /* The offset of the first BLKmode parameter which 
  4148.      *must* be passed in memory.  */
  4149.   int BLKmode_parms_first_offset = 0;
  4150.   /* Total size of BLKmode parms which could usefully be preallocated.  */
  4151.   int BLKmode_parms_sizes = 0;
  4152.  
  4153.   /* Amount stack was adjusted to protect BLKmode parameters
  4154.      which are below the nominal "stack address" value.  */
  4155.   rtx protected_stack = 0;
  4156.  
  4157.   /* The last insn before the things that are intrinsically part of the call.
  4158.      The beginning reg-note goes on the insn after this one.  */
  4159.   rtx insn_before;
  4160.  
  4161.   rtx old_stack_level = 0;
  4162.   int old_pending_adj;
  4163.   int old_inhibit_defer_pop = inhibit_defer_pop;
  4164.   tree old_cleanups = cleanups_this_call;
  4165.   rtx use_insns;
  4166.  
  4167.   register tree p;
  4168.   register int i;
  4169.  
  4170.   /* See if we can find a DECL-node for the actual function.
  4171.      As a result, decide whether this is a call to an integrable function.  */
  4172.  
  4173.   p = TREE_OPERAND (exp, 0);
  4174.   if (TREE_CODE (p) == ADDR_EXPR)
  4175.     {
  4176.       fndecl = TREE_OPERAND (p, 0);
  4177.       if (TREE_CODE (fndecl) != FUNCTION_DECL)
  4178.     {
  4179.       /* May still be a `const' function if it is
  4180.          a call through a const function.  */
  4181.       fndecl = 0;
  4182.     }
  4183.       else
  4184.     {
  4185.       extern tree current_function_decl;
  4186.  
  4187.       if (fndecl != current_function_decl
  4188.           && DECL_SAVED_INSNS (fndecl))
  4189.         is_integrable = 1;
  4190.       else if (! TREE_ADDRESSABLE (fndecl))
  4191.         {
  4192.           /* In case this function later becomes inlineable,
  4193.          record that there was already a non-inline call to it.
  4194.  
  4195.          Use abstraction instead of setting TREE_ADDRESSABLE
  4196.          directly.  */
  4197.           if (TREE_INLINE (fndecl) && extra_warnings)
  4198.         warning_with_decl (fndecl, "can't inline call to `%s' which was declared inline");
  4199.           mark_addressable (fndecl);
  4200.         }
  4201.  
  4202.       if (TREE_READONLY (fndecl) && ! TREE_THIS_VOLATILE (fndecl))
  4203.         is_const = 1;
  4204.     }
  4205.     }
  4206.  
  4207.   /* When calling a const function, we must pop the stack args right away,
  4208.      so that the pop is deleted or moved with the call.  */
  4209.   if (is_const)
  4210.     NO_DEFER_POP;
  4211.  
  4212.   /* Set up a place to return a structure.  */
  4213.  
  4214.   /* Cater to broken compilers.  */
  4215.   if (aggregate_value_p (exp))
  4216.     {
  4217.       /* This call returns a big structure.  */
  4218. #ifdef PCC_STATIC_STRUCT_RETURN
  4219.       if (flag_pcc_struct_return)
  4220.     {
  4221.       pcc_struct_value = 1;
  4222.       is_integrable = 0;  /* Easier than making that case work right.  */
  4223.     }
  4224.       else
  4225. #endif
  4226.     {
  4227.       if (target && GET_CODE (target) == MEM)
  4228.         {
  4229.           structure_value_addr = XEXP (target, 0);
  4230.           if (reg_mentioned_p (stack_pointer_rtx, structure_value_addr))
  4231.         structure_value_addr = copy_to_reg (structure_value_addr);
  4232.         }
  4233.       else
  4234.         {
  4235.           /* Make room on the stack to hold the value.  */
  4236.           structure_value_addr
  4237.         = get_structure_value_addr (expr_size (exp));
  4238.           target = 0;
  4239.         }
  4240.     }
  4241.     }
  4242.  
  4243.   /* If called function is inline, try to integrate it.  */
  4244.  
  4245.   if (is_integrable)
  4246.     {
  4247.       extern rtx expand_inline_function ();
  4248.       rtx temp;
  4249.  
  4250.       temp = expand_inline_function (fndecl, actparms, target,
  4251.                      ignore, TREE_TYPE (exp),
  4252.                      structure_value_addr);
  4253.  
  4254.       /* If inlining succeeded, return.  */
  4255.       if ((int) temp != -1)
  4256.     {
  4257.       /* Perform all cleanups needed for the arguments of this call
  4258.          (i.e. destructors in C++).  It is ok if these destructors
  4259.          clobber RETURN_VALUE_REG, because the only time we care about
  4260.          this is when TARGET is that register.  But in C++, we take
  4261.          care to never return that register directly.  */
  4262.       expand_cleanups_to (old_cleanups);
  4263.       return temp;
  4264.     }
  4265.  
  4266.       /* If inlining failed, mark FNDECL as needing to be compiled
  4267.      separately after all.
  4268.  
  4269.      Use abstraction instead of setting TREE_ADDRESSABLE directly.  */
  4270.       mark_addressable (fndecl);
  4271.     }
  4272.  
  4273. #if 0
  4274.   /* Unless it's a call to a specific function that isn't alloca,
  4275.      if it has one argument, we must assume it might be alloca.  */
  4276.  
  4277.   may_be_alloca =
  4278.     (!(fndecl != 0
  4279.        && strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)),
  4280.           "alloca"))
  4281.      && actparms != 0
  4282.      && TREE_CHAIN (actparms) == 0);
  4283. #else
  4284.   /* We assume that alloca will always be called by name.  It
  4285.      makes no sense to pass it as a pointer-to-function to
  4286.      anything that does not understand its behavior.  */
  4287.   may_be_alloca =
  4288.     (fndecl && (! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "alloca")
  4289.         || ! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)),
  4290.                  "__builtin_alloca")));
  4291. #endif
  4292.  
  4293.   /* See if this is a call to a function that can return more than once.  */
  4294.  
  4295.   is_setjmp
  4296.     = (fndecl != 0
  4297.        && (!strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "setjmp")
  4298.        || !strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "_setjmp")));
  4299.  
  4300.   is_builtin_new
  4301.     = (fndecl != 0
  4302.        && (!strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "__builtin_new")));
  4303.  
  4304.   if (may_be_alloca)
  4305.     {
  4306.       frame_pointer_needed = 1;
  4307.       may_call_alloca = 1;
  4308.       current_function_calls_alloca = 1;
  4309.     }
  4310.  
  4311.   /* Don't let pending stack adjusts add up to too much.
  4312.      Also, do all pending adjustments now
  4313.      if there is any chance this might be a call to alloca.  */
  4314.  
  4315.   if (pending_stack_adjust >= 32
  4316.       || (pending_stack_adjust > 0 && may_be_alloca))
  4317.     do_pending_stack_adjust ();
  4318.  
  4319.   /* Operand 0 is a pointer-to-function; get the type of the function.  */
  4320.   funtype = TREE_TYPE (TREE_OPERAND (exp, 0));
  4321.   if (TREE_CODE (funtype) != POINTER_TYPE)
  4322.     abort ();
  4323.   funtype = TREE_TYPE (funtype);
  4324.  
  4325.   /* If struct_value_rtx is 0, it means pass the address
  4326.      as if it were an extra parameter.  */
  4327.   if (structure_value_addr && struct_value_rtx == 0)
  4328.     {
  4329.       rtx tem;
  4330.  
  4331.       INIT_CUMULATIVE_ARGS (args_so_far, funtype);
  4332.       tem = FUNCTION_ARG (args_so_far, Pmode,
  4333.               build_pointer_type (TREE_TYPE (funtype)), 1);
  4334.       if (tem == 0)
  4335.     {
  4336.       actparms = tree_cons (error_mark_node,
  4337.                 build (SAVE_EXPR,
  4338.                        type_for_size (GET_MODE_BITSIZE (Pmode), 0),
  4339.                        0,
  4340.                        force_reg (Pmode, structure_value_addr)),
  4341.                 actparms);
  4342.       structure_value_addr_parm = 1;
  4343.     }
  4344.     }
  4345.  
  4346.   /* Count the arguments and set NUM_ACTUALS.  */
  4347.   for (p = actparms, i = 0; p; p = TREE_CHAIN (p)) i++;
  4348.   num_actuals = i;
  4349.  
  4350.   /* Compute number of named args.
  4351.      Don't include the last named arg if anonymous args follow.
  4352.      (If no anonymous args follow, the result of list_length
  4353.      is actually one too large.)  */
  4354.   if (TYPE_ARG_TYPES (funtype) != 0)
  4355.     n_named_args = list_length (TYPE_ARG_TYPES (funtype)) - 1;
  4356.   else
  4357.     /* If we know nothing, treat all args as named.  */
  4358.     n_named_args = num_actuals;
  4359.  
  4360.   /* Make a vector to hold all the information about each arg.  */
  4361.   args = (struct arg_data *) alloca (num_actuals * sizeof (struct arg_data));
  4362.   bzero (args, num_actuals * sizeof (struct arg_data));
  4363.  
  4364.   args_size.constant = 0;
  4365.   args_size.var = 0;
  4366. #ifdef FIRST_PARM_CALLER_OFFSET
  4367.   args_size.constant = FIRST_PARM_CALLER_OFFSET (funtype);
  4368.   stack_count_regparms = 1;
  4369. #endif
  4370.   starting_args_size = args_size.constant;
  4371.  
  4372.   /* In this loop, we consider args in the order they are written.
  4373.      We fill up ARGS from the front of from the back if necessary
  4374.      so that in any case the first arg to be pushed ends up at the front.  */
  4375.  
  4376. #ifdef PUSH_ARGS_REVERSED
  4377.   i = num_actuals - 1, inc = -1;
  4378.   /* In this case, must reverse order of args
  4379.      so that we compute and push the last arg first.  */
  4380. #else
  4381.   i = 0, inc = 1;
  4382. #endif
  4383.  
  4384.   INIT_CUMULATIVE_ARGS (args_so_far, funtype);
  4385.  
  4386.   for (p = actparms; p; p = TREE_CHAIN (p), i += inc)
  4387.     {
  4388.       tree type = TREE_TYPE (TREE_VALUE (p));
  4389.       args[i].tree_value = TREE_VALUE (p);
  4390.       args[i].offset = args_size;
  4391.  
  4392.       if (type == error_mark_node
  4393.       || TYPE_SIZE (type) == 0)
  4394.     continue;
  4395.  
  4396.       /* Decide where to pass this arg.  */
  4397.       /* args[i].reg is nonzero if all or part is passed in registers.
  4398.      args[i].partial is nonzero if part but not all is passed in registers,
  4399.       and the exact value says how many words are passed in registers.  */
  4400.  
  4401.       if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST
  4402.       && args_size.var == 0
  4403.       /* error_mark_node here is a flag for the fake argument
  4404.          for a structure value address.  */
  4405.       && TREE_PURPOSE (p) != error_mark_node)
  4406.     {
  4407.       args[i].reg = FUNCTION_ARG (args_so_far, TYPE_MODE (type), type,
  4408.                       i < n_named_args);
  4409.       /* If this argument needs more than the usual parm alignment, do
  4410.          extrinsic padding to reach that alignment.  */
  4411.  
  4412. #ifdef MAX_PARM_BOUNDARY
  4413.       /* If MAX_PARM_BOUNDARY is not defined, it means that the usual
  4414.          alignment requirements are relaxed for parms, and that no parm
  4415.          needs more than PARM_BOUNDARY, regardless of data type.  */
  4416.  
  4417.       if (PARM_BOUNDARY < TYPE_ALIGN (type))
  4418.         {
  4419.           int boundary = PARM_BOUNDARY;
  4420.  
  4421.           /* Determine the boundary to pad up to.  */
  4422.           if (TYPE_ALIGN (type) > boundary)
  4423.         boundary = TYPE_ALIGN (type);
  4424.           if (boundary > MAX_PARM_BOUNDARY)
  4425.         boundary = MAX_PARM_BOUNDARY;
  4426.  
  4427.           /* If the previous args don't reach such a boundary,
  4428.          advance to the next one.  */
  4429.           boundary /= BITS_PER_UNIT;
  4430.           args[i].offset.constant += boundary - 1;
  4431.           args[i].offset.constant &= ~(boundary - 1);
  4432.           args_size.constant += boundary - 1;
  4433.           args_size.constant &= ~(boundary - 1);
  4434.  
  4435.           if (args_size.var != 0)
  4436.         abort ();        /* This case not implemented yet */
  4437.         }
  4438. #endif /* MAX_PARM_BOUNDARY */
  4439.  
  4440. #ifdef FUNCTION_ARG_PARTIAL_NREGS
  4441.       args[i].partial
  4442.         = FUNCTION_ARG_PARTIAL_NREGS (args_so_far,
  4443.                       TYPE_MODE (type), type,
  4444.                       i < n_named_args);
  4445. #endif
  4446.     }
  4447.  
  4448.       /* Compute the stack-size of this argument.  */
  4449.  
  4450.       if (args[i].reg != 0 && args[i].partial == 0
  4451.       && ! stack_count_regparms)
  4452.     /* On most machines, don't count stack space for a register arg.  */
  4453.     ;
  4454.       else if (TYPE_MODE (type) != BLKmode)
  4455.     {
  4456.       register int size;
  4457.  
  4458.       size = GET_MODE_SIZE (TYPE_MODE (type));
  4459.       /* Compute how much space the push instruction will push.
  4460.          On many machines, pushing a byte will advance the stack
  4461.          pointer by a halfword.  */
  4462. #ifdef PUSH_ROUNDING
  4463.       size = PUSH_ROUNDING (size);
  4464. #endif
  4465.       /* Compute how much space the argument should get:
  4466.          maybe pad to a multiple of the alignment for arguments.  */
  4467.       if (none == FUNCTION_ARG_PADDING (TYPE_MODE (type), const0_rtx))
  4468.         args[i].size.constant = size;
  4469.       else
  4470.         args[i].size.constant
  4471.           = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  4472.           / (PARM_BOUNDARY / BITS_PER_UNIT))
  4473.          * (PARM_BOUNDARY / BITS_PER_UNIT));
  4474.     }
  4475.       else
  4476.     {
  4477.       register tree size = size_in_bytes (type);
  4478.  
  4479.       /* A nonscalar.  Round its size up to a multiple
  4480.          of PARM_BOUNDARY bits, unless it is not supposed to be padded.  */
  4481.       if (none
  4482.           != FUNCTION_ARG_PADDING (TYPE_MODE (type),
  4483.                        expand_expr (size, 0, VOIDmode, 0)))
  4484.         size = convert_units (convert_units (size, BITS_PER_UNIT,
  4485.                          PARM_BOUNDARY),
  4486.                   PARM_BOUNDARY, BITS_PER_UNIT);
  4487.       ADD_PARM_SIZE (args[i].size, size);
  4488.  
  4489.       /* Certain data types may not be passed in registers
  4490.          (eg C++ classes with constructors).
  4491.          Also, BLKmode parameters initialized from CALL_EXPRs
  4492.          are treated specially, if it is a win to do so.  */
  4493.       if (TREE_CODE (TREE_VALUE (p)) == CALL_EXPR
  4494.           || TREE_ADDRESSABLE (type))
  4495.         {
  4496.           if (TREE_ADDRESSABLE (type))
  4497.         BLKmode_parms_forced = 1;
  4498.           /* This is a marker for such a parameter.  */
  4499.           args[i].stack = const0_rtx;
  4500.           BLKmode_parms_sizes += TREE_INT_CST_LOW (size);
  4501.  
  4502.           /* If this parm's location is "below" the nominal stack pointer,
  4503.          note to decrement the stack pointer while it is computed.  */
  4504. #ifdef FIRST_PARM_CALLER_OFFSET
  4505.           if (BLKmode_parms_first_offset == 0)
  4506.         BLKmode_parms_first_offset
  4507.           /* If parameter's offset is variable, assume the worst.  */
  4508.           = (args[i].offset.var
  4509.              ? FIRST_PARM_CALLER_OFFSET (funtype)
  4510.              : args[i].offset.constant);
  4511. #endif
  4512.         }
  4513.     }
  4514.  
  4515.       /* If a part of the arg was put into registers,
  4516.      don't include that part in the amount pushed.  */
  4517.       if (! stack_count_regparms)
  4518.     args[i].size.constant
  4519.       -= ((args[i].partial * UNITS_PER_WORD)
  4520.           / (PARM_BOUNDARY / BITS_PER_UNIT)
  4521.           * (PARM_BOUNDARY / BITS_PER_UNIT));
  4522.  
  4523.       /* Update ARGS_SIZE, the total stack space for args so far.  */
  4524.  
  4525.       args_size.constant += args[i].size.constant;
  4526.       if (args[i].size.var)
  4527.     {
  4528.       ADD_PARM_SIZE (args_size, args[i].size.var);
  4529.     }
  4530.  
  4531.       /* Increment ARGS_SO_FAR, which has info about which arg-registers
  4532.      have been used, etc.  */
  4533.  
  4534.       FUNCTION_ARG_ADVANCE (args_so_far, TYPE_MODE (type), type,
  4535.                 i < n_named_args);
  4536.     }
  4537.  
  4538.   /* If we would have to push a partially-in-regs parm
  4539.      before other stack parms, preallocate stack space instead.  */
  4540.   must_preallocate = 0;
  4541.   {
  4542.     int partial_seen = 0;
  4543.     for (i = 0; i < num_actuals; i++)
  4544.       {
  4545.     if (args[i].partial > 0)
  4546.       partial_seen = 1;
  4547.     else if (partial_seen && args[i].reg == 0)
  4548.       must_preallocate = 1;
  4549.       }
  4550.   }
  4551.  
  4552.   /* Precompute all register parameters.  It isn't safe to compute anything
  4553.      once we have started filling any specific hard regs.
  4554.      If this function call is cse'able, precompute all the parameters.  */
  4555.  
  4556.   reg_parm_seen = 0;
  4557.   for (i = 0; i < num_actuals; i++)
  4558.     if (args[i].reg != 0 || is_const)
  4559.       {
  4560.     int j;
  4561.     int struct_value_lossage = 0;
  4562.  
  4563.     /* First, see if this is a precomputed struct-returning function call
  4564.        and other subsequent parms are also such.  */
  4565.     if ((TYPE_MODE (TREE_TYPE (args[i].tree_value)) == BLKmode
  4566.          || RETURN_IN_MEMORY (TREE_TYPE (args[i].tree_value)))
  4567.         && TREE_CODE (args[i].tree_value) == CALL_EXPR)
  4568.       for (j = i + 1; j < num_actuals; j++)
  4569.         if ((TYPE_MODE (TREE_TYPE (args[j].tree_value)) == BLKmode
  4570.          || RETURN_IN_MEMORY (TREE_TYPE (args[j].tree_value)))
  4571.         && TREE_CODE (args[j].tree_value) == CALL_EXPR
  4572.         && args[j].reg != 0 || is_const)
  4573.           {
  4574.         /* We have two precomputed structure-values call expressions
  4575.            in our parm list.  Both of them would normally use
  4576.            the structure-value block.  To avoid the conflict,
  4577.            compute this parm with a different temporary block.  */
  4578.         int size = int_size_in_bytes (TREE_TYPE (args[i].tree_value));
  4579.         rtx structval = assign_stack_local (BLKmode, size);
  4580.         args[i].value = expand_expr (args[i].tree_value, structval,
  4581.                          VOIDmode, 0);
  4582.         struct_value_lossage = 1;
  4583.         break;
  4584.           }
  4585.     if (!struct_value_lossage)
  4586.       args[i].value = expand_expr (args[i].tree_value, 0, VOIDmode, 0);
  4587.  
  4588.     if (args[i].reg != 0)
  4589.       reg_parm_seen = 1;
  4590.  
  4591.     if (GET_CODE (args[i].value) != MEM
  4592.         && ! CONSTANT_P (args[i].value)
  4593.         && GET_CODE (args[i].value) != CONST_DOUBLE)
  4594.       args[i].value
  4595.         = force_reg (TYPE_MODE (TREE_TYPE (args[i].tree_value)),
  4596.              args[i].value);
  4597.     /* ANSI doesn't require a sequence point here,
  4598.        but PCC has one, so this will avoid some problems.  */
  4599.     emit_queue ();
  4600.       }
  4601.  
  4602.   /* Get the function to call, in the form of RTL, if it is a constant.  */
  4603.   if (fndecl && is_const)
  4604.     {
  4605.       /* Get a SYMBOL_REF rtx for the function address.  */
  4606.       funexp = XEXP (DECL_RTL (fndecl), 0);
  4607.  
  4608. #ifndef NO_FUNCTION_CSE
  4609.       /* Pass the address through a pseudoreg, if desired,
  4610.      before the "beginning" of the library call.
  4611.      So this insn isn't "part of" the library call, in case that
  4612.      is deleted, or cse'd.  */
  4613.       if (! flag_no_function_cse)
  4614.     funexp = copy_to_mode_reg (Pmode, funexp);
  4615. #endif
  4616.     }
  4617.  
  4618.   /* Now we are about to start emitting insns that can be deleted
  4619.      if the libcall is deleted.  */
  4620.   insn_before = get_last_insn ();
  4621.  
  4622.   /* Maybe do additional rounding on the size of the arguments.  */
  4623. #ifdef STACK_ARGS_ADJUST
  4624.   STACK_ARGS_ADJUST (args_size);
  4625. #endif
  4626.  
  4627.   /* If we have no actual push instructions, or shouldn't use them,
  4628.      or we need a variable amount of space, make space for all args right now.
  4629.      Round the needed size up to multiple of STACK_BOUNDARY.  */
  4630.  
  4631.   if (args_size.var != 0)
  4632.     {
  4633.       old_stack_level = copy_to_mode_reg (Pmode, stack_pointer_rtx);
  4634.       old_pending_adj = pending_stack_adjust;
  4635.       argblock = push_block (round_push (ARGS_SIZE_RTX (args_size)));
  4636.     }
  4637.   else if (args_size.constant > 0)
  4638.     {
  4639.       int needed = args_size.constant;
  4640.  
  4641. #ifdef STACK_BOUNDARY
  4642.       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  4643. #endif
  4644.       args_size.constant = needed;
  4645.  
  4646.       if (
  4647. #ifndef PUSH_ROUNDING
  4648.       1  /* Always preallocate if no push insns.  */
  4649. #else
  4650.       must_preallocate || BLKmode_parms_forced
  4651.       || BLKmode_parms_sizes > (args_size.constant >> 1)
  4652. #endif
  4653.       )
  4654.     {
  4655.       /* Try to reuse some or all of the pending_stack_adjust
  4656.          to get this space.  Maybe we can avoid any pushing.  */
  4657.       if (needed > pending_stack_adjust)
  4658.         {
  4659.           needed -= pending_stack_adjust;
  4660.           pending_stack_adjust = 0;
  4661.         }
  4662.       else
  4663.         {
  4664.           pending_stack_adjust -= needed;
  4665.           needed = 0;
  4666.         }
  4667.       argblock = push_block (gen_rtx (CONST_INT, VOIDmode, needed));
  4668.  
  4669.       /* Once this space is used, we cannot give other calls
  4670.          (which might be part of the args to this call)
  4671.          access to this space.  This is because there is
  4672.          no way to say that we are building arguments
  4673.          in a place which should not be deallocated by
  4674.          `emit_call_1', which, by the way, is the way this
  4675.          this space gets deallocated.  */
  4676.       do_pending_stack_adjust ();
  4677.     }
  4678.     }
  4679. #ifndef PUSH_ROUNDING
  4680.   else if (BLKmode_parms_forced)
  4681.     {
  4682.       /* If we have reg-parms that need to be temporarily on the stack,
  4683.      set up an arg block address even though there is no space
  4684.      to be allocated for it.  */
  4685.       argblock = push_block (const0_rtx);
  4686.     }
  4687. #endif
  4688.  
  4689. #if 0
  4690.   /* If stack needs padding below the args, increase all arg offsets
  4691.      so the args are stored above the padding.  */
  4692.   if (stack_padding)
  4693.     for (i = 0; i < num_actuals; i++)
  4694.       args[i].offset.constant += stack_padding;
  4695. #endif
  4696.  
  4697.   /* Don't try to defer pops if preallocating, not even from the first arg,
  4698.      since ARGBLOCK probably refers to the SP.  */
  4699.   if (argblock)
  4700.     NO_DEFER_POP;
  4701.  
  4702. #ifdef STACK_GROWS_DOWNWARD
  4703.   /* If any BLKmode parms need to be preallocated in space
  4704.      below the nominal stack-pointer address, we need to adjust the
  4705.      stack pointer so that this location is temporarily above it.
  4706.      This ensures that computation won't clobber that space.  */
  4707.   if (BLKmode_parms_first_offset < 0 && argblock != 0)
  4708.     {
  4709.       int needed = -BLKmode_parms_first_offset;
  4710.       argblock = copy_to_reg (argblock);
  4711.  
  4712. #ifdef STACK_BOUNDARY
  4713.       needed = (needed + STACK_BYTES - 1) / STACK_BYTES * STACK_BYTES;
  4714. #endif
  4715.       protected_stack = gen_rtx (CONST_INT, VOIDmode, needed);
  4716.       anti_adjust_stack (protected_stack);
  4717.     }
  4718. #endif /* STACK_GROWS_DOWNWARD */
  4719.  
  4720.   /* Get the function to call, in the form of RTL.  */
  4721.   if (fndecl)
  4722.     /* Get a SYMBOL_REF rtx for the function address.  */
  4723.     funexp = XEXP (DECL_RTL (fndecl), 0);
  4724.   else
  4725.     /* Generate an rtx (probably a pseudo-register) for the address.  */
  4726.     {
  4727.       funexp = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  4728.       emit_queue ();
  4729.     }
  4730.  
  4731.   /* Figure out the register where the value, if any, will come back.  */
  4732.   valreg = 0;
  4733.   if (TYPE_MODE (TREE_TYPE (exp)) != VOIDmode
  4734.       && TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
  4735.     valreg = hard_function_value (TREE_TYPE (exp), fndecl);
  4736.  
  4737.   /* Now compute and store all non-register parms.
  4738.      These come before register parms, since they can require block-moves,
  4739.      which could clobber the registers used for register parms.
  4740.      Parms which have partial registers are not stored here,
  4741.      but we do preallocate space here if they want that.  */
  4742.  
  4743.   for (i = 0; i < num_actuals; i++)
  4744.     {
  4745.       /* Preallocate the stack space for a parm if appropriate
  4746.      so it can be computed directly in the stack space.  */
  4747.       if (args[i].stack != 0 && argblock != 0)
  4748.     args[i].stack = target_for_arg (TREE_TYPE (args[i].tree_value),
  4749.                     ARGS_SIZE_RTX (args[i].size),
  4750.                     argblock, args[i].offset);
  4751.       else
  4752.     args[i].stack = 0;
  4753.  
  4754.       if (args[i].reg == 0
  4755.       && TYPE_SIZE (TREE_TYPE (args[i].tree_value)) != 0)
  4756.     store_one_arg (&args[i], argblock, may_be_alloca);
  4757.     }
  4758.  
  4759.   /* Now store any partially-in-registers parm.
  4760.      This is the last place a block-move can happen.  */
  4761.   if (reg_parm_seen)
  4762.     for (i = 0; i < num_actuals; i++)
  4763.       if (args[i].partial != 0)
  4764.     store_one_arg (&args[i], argblock, may_be_alloca);
  4765.  
  4766.   if (protected_stack != 0)
  4767.     adjust_stack (protected_stack);
  4768.  
  4769.   /* Pass the function the address in which to return a structure value.  */
  4770.   if (structure_value_addr && ! structure_value_addr_parm)
  4771.     emit_move_insn (struct_value_rtx,
  4772.             force_reg (Pmode, force_operand (structure_value_addr, 0)));
  4773.  
  4774.   /* Now set up any wholly-register parms.  They were computed already.  */
  4775.   if (reg_parm_seen)
  4776.     for (i = 0; i < num_actuals; i++)
  4777.       if (args[i].reg != 0 && args[i].partial == 0)
  4778.     store_one_arg (&args[i], argblock, may_be_alloca);
  4779.  
  4780.   /* Perform postincrements before actually calling the function.  */
  4781.   emit_queue ();
  4782.  
  4783.   /* All arguments and registers used for the call must be set up by now!  */
  4784.  
  4785.   /* ??? Other languages need a nontrivial second argument (static chain).  */
  4786.   funexp = prepare_call_address (funexp, 0);
  4787.  
  4788.   /* Mark all register-parms as living through the call.  */
  4789.   start_sequence ();
  4790.   for (i = 0; i < num_actuals; i++)
  4791.     if (args[i].reg != 0)
  4792.       {
  4793.     if (args[i].partial > 0)
  4794.       use_regs (REGNO (args[i].reg), args[i].partial);
  4795.     else if (GET_MODE (args[i].reg) == BLKmode)
  4796.       use_regs (REGNO (args[i].reg),
  4797.             ((int_size_in_bytes (TREE_TYPE (args[i].tree_value))
  4798.               + UNITS_PER_WORD - 1)
  4799.              / UNITS_PER_WORD));
  4800.     else
  4801.       emit_insn (gen_rtx (USE, VOIDmode, args[i].reg));
  4802.       }
  4803.  
  4804.   if (structure_value_addr && ! structure_value_addr_parm
  4805.       && GET_CODE (struct_value_rtx) == REG)
  4806.     emit_insn (gen_rtx (USE, VOIDmode, struct_value_rtx));
  4807.  
  4808.   use_insns = gen_sequence ();
  4809.   end_sequence ();
  4810.  
  4811.   /* Generate the actual call instruction.  */
  4812.   /* This also has the effect of turning off any pop-inhibition
  4813.      done in expand_call.  */
  4814.   if (args_size.constant < 0)
  4815.     args_size.constant = 0;
  4816.   emit_call_1 (funexp, funtype, args_size.constant,
  4817.            FUNCTION_ARG (args_so_far, VOIDmode, void_type_node, 1),
  4818.            valreg, old_inhibit_defer_pop, use_insns);
  4819.  
  4820. /* ???  Nothing has been done here to record control flow
  4821.    when contained functions can do nonlocal gotos.  */
  4822.  
  4823.   /* For calls to `setjmp', etc., inform flow.c it should complain
  4824.      if nonvolatile values are live.  */
  4825.  
  4826.   if (is_setjmp)
  4827.     {
  4828.       emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_SETJMP);
  4829.       current_function_calls_setjmp = 1;
  4830.     }
  4831.  
  4832.   /* Notice functions that cannot return.
  4833.      If optimizing, insns emitted below will be dead.
  4834.      If not optimizing, they will exist, which is useful
  4835.      if the user uses the `return' command in the debugger.  */
  4836.  
  4837.   if (fndecl && TREE_THIS_VOLATILE (fndecl))
  4838.     emit_barrier ();
  4839.  
  4840.   /* For calls to __builtin_new, note that it can never return 0.
  4841.      This is because a new handler will be called, and 0 it not
  4842.      among the numbers it is supposed to return.  */
  4843. #if 0
  4844.   if (is_builtin_new)
  4845.     emit_note (IDENTIFIER_POINTER (DECL_NAME (fndecl)), NOTE_INSN_BUILTIN_NEW);
  4846. #endif
  4847.  
  4848.   /* If there are cleanups to be called, don't use a hard reg as target.  */
  4849.   if (cleanups_this_call != old_cleanups
  4850.       && target && REG_P (target)
  4851.       && REGNO (target) < FIRST_PSEUDO_REGISTER)
  4852.     target = 0;
  4853.  
  4854.   /* If value type not void, return an rtx for the value.  */
  4855.  
  4856.   if (TYPE_MODE (TREE_TYPE (exp)) == VOIDmode
  4857.       || ignore)
  4858.     {
  4859.       target = const0_rtx;
  4860.     }
  4861.   else if (structure_value_addr)
  4862.     {
  4863.       if (target == 0 || GET_CODE (target) != MEM)
  4864.     target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4865.               memory_address (BLKmode, structure_value_addr));
  4866.     }
  4867.   else if (pcc_struct_value)
  4868.     {
  4869.       valreg = hard_function_value (build_pointer_type (TREE_TYPE (exp)),
  4870.                     fndecl);
  4871.       if (target == 0)
  4872.     target = gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4873.               copy_to_reg (valreg));
  4874.       else if (TYPE_MODE (TREE_TYPE (exp)) != BLKmode)
  4875.     emit_move_insn (target, gen_rtx (MEM, TYPE_MODE (TREE_TYPE (exp)),
  4876.                      copy_to_reg (valreg)));
  4877.       else
  4878.     emit_block_move (target, gen_rtx (MEM, BLKmode, copy_to_reg (valreg)),
  4879.              expr_size (exp),
  4880.              TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  4881.     }
  4882.   else if (target && GET_MODE (target) == TYPE_MODE (TREE_TYPE (exp)))
  4883.     {
  4884.       if (!rtx_equal_p (target, valreg))
  4885.     emit_move_insn (target, valreg);
  4886.       else
  4887.     /* This tells expand_inline_function to copy valreg to its target.  */
  4888.     emit_insn (gen_rtx (USE, VOIDmode, valreg));
  4889.     }
  4890.   else
  4891.     target = copy_to_reg (valreg);
  4892.  
  4893.   /* Perform all cleanups needed for the arguments of this call
  4894.      (i.e. destructors in C++).  */
  4895.   expand_cleanups_to (old_cleanups);
  4896.  
  4897.   /* If size of args is variable, restore saved stack-pointer value.  */
  4898.  
  4899.   if (old_stack_level)
  4900.     {
  4901.       emit_move_insn (stack_pointer_rtx, old_stack_level);
  4902.       pending_stack_adjust = old_pending_adj;
  4903.     }
  4904.  
  4905.   /* If call is cse'able, make appropriate pair of reg-notes around it.  */
  4906.   if (is_const)
  4907.     {
  4908.       rtx insn_first = NEXT_INSN (insn_before);
  4909.       rtx insn_last = get_last_insn ();
  4910.       rtx note = 0;
  4911.  
  4912.       /* Don't put the notes on if we don't have insns that can hold them.  */
  4913.       if ((GET_CODE (insn_first) == INSN
  4914.        || GET_CODE (insn_first) == CALL_INSN
  4915.        || GET_CODE (insn_first) == JUMP_INSN)
  4916.       && (GET_CODE (insn_last) == INSN
  4917.           || GET_CODE (insn_last) == CALL_INSN
  4918.           || GET_CODE (insn_last) == JUMP_INSN))
  4919.     {
  4920.       /* Construct an "equal form" for the value
  4921.          which mentions all the arguments in order
  4922.          as well as the function name.  */
  4923.       for (i = 0; i < num_actuals; i++)
  4924.         if (args[i].reg != 0 || is_const)
  4925.           note = gen_rtx (EXPR_LIST, VOIDmode, args[i].value, note);
  4926.       note = gen_rtx (EXPR_LIST, VOIDmode,
  4927.               XEXP (DECL_RTL (fndecl), 0), note);
  4928.  
  4929.       REG_NOTES (insn_last)
  4930.         = gen_rtx (EXPR_LIST, REG_EQUAL, note,
  4931.                gen_rtx (INSN_LIST, REG_RETVAL, insn_first,
  4932.                 REG_NOTES (insn_last)));
  4933.       REG_NOTES (insn_first)
  4934.         = gen_rtx (INSN_LIST, REG_LIBCALL, insn_last,
  4935.                REG_NOTES (insn_first));
  4936.     }
  4937.     }
  4938.  
  4939.   return target;
  4940. }
  4941.  
  4942. /* Return an rtx which represents a suitable home on the stack
  4943.    given TYPE, the type of the argument looking for a home.
  4944.    This is called only for BLKmode arguments.
  4945.  
  4946.    SIZE is the size needed for this target.
  4947.    ARGS_ADDR is the address of the bottom of the argument block for this call.
  4948.    OFFSET describes this parameter's offset into ARGS_ADDR.  It is meaningless
  4949.    if this machine uses push insns.  */
  4950.  
  4951. static rtx
  4952. target_for_arg (type, size, args_addr, offset)
  4953.      tree type;
  4954.      rtx size;
  4955.      rtx args_addr;
  4956.      struct args_size offset;
  4957. {
  4958.   rtx target;
  4959.   rtx offset_rtx = ARGS_SIZE_RTX (offset);
  4960.  
  4961.   /* We do not call memory_address if possible,
  4962.      because we want to address as close to the stack
  4963.      as possible.  For non-variable sized arguments,
  4964.      this will be stack-pointer relative addressing.  */
  4965.   if (GET_CODE (offset_rtx) == CONST_INT)
  4966.     target = plus_constant (args_addr, INTVAL (offset_rtx));
  4967.   else
  4968.     {
  4969.       /* I have no idea how to guarantee that this
  4970.      will work in the presence of register parameters.  */
  4971.       target = gen_rtx (PLUS, Pmode, args_addr, offset_rtx);
  4972.       target = memory_address (QImode, target);
  4973.     }
  4974.  
  4975.   return gen_rtx (MEM, BLKmode, target);
  4976. }
  4977.  
  4978. /* Store a single argument for a function call
  4979.    into the register or memory area where it must be passed.
  4980.    *ARG describes the argument value and where to pass it.
  4981.    ARGBLOCK is the address of the stack-block for all the arguments,
  4982.    or 0 on a machine where arguemnts are pushed individually.
  4983.    MAY_BE_ALLOCA nonzero says this could be a call to `alloca'
  4984.    so must be careful about how the stack is used.  */
  4985.  
  4986. static void
  4987. store_one_arg (arg, argblock, may_be_alloca)
  4988.      struct arg_data *arg;
  4989.      rtx argblock;
  4990.      int may_be_alloca;
  4991. {
  4992.   register tree pval = arg->tree_value;
  4993.   int used = 0;
  4994.  
  4995.   if (TREE_CODE (pval) == ERROR_MARK)
  4996.     return;
  4997.  
  4998.   if (arg->reg != 0 && arg->partial == 0)
  4999.     {
  5000.       /* Being passed entirely in a register.  */
  5001.       if (arg->value != 0)
  5002.     {
  5003.       if (GET_MODE (arg->value) == BLKmode)
  5004.         move_block_to_reg (REGNO (arg->reg), arg->value,
  5005.                    ((int_size_in_bytes (TREE_TYPE (pval))
  5006.                  + UNITS_PER_WORD - 1)
  5007.                 / UNITS_PER_WORD));
  5008.       else
  5009.         emit_move_insn (arg->reg, arg->value);
  5010.     }
  5011.       else
  5012.     store_expr (pval, arg->reg, 0);
  5013.  
  5014.       /* Don't allow anything left on stack from computation
  5015.      of argument to alloca.  */
  5016.       if (may_be_alloca)
  5017.     do_pending_stack_adjust ();
  5018.     }
  5019.   else if (TYPE_MODE (TREE_TYPE (pval)) != BLKmode)
  5020.     {
  5021.       register int size;
  5022.       rtx tem;
  5023.  
  5024.       /* Argument is a scalar, not entirely passed in registers.
  5025.      (If part is passed in registers, arg->partial says how much
  5026.      and emit_push_insn will take care of putting it there.)
  5027.      
  5028.      Push it, and if its size is less than the
  5029.      amount of space allocated to it,
  5030.      also bump stack pointer by the additional space.
  5031.      Note that in C the default argument promotions
  5032.      will prevent such mismatches.  */
  5033.  
  5034.       used = size = GET_MODE_SIZE (TYPE_MODE (TREE_TYPE (pval)));
  5035.       /* Compute how much space the push instruction will push.
  5036.      On many machines, pushing a byte will advance the stack
  5037.      pointer by a halfword.  */
  5038. #ifdef PUSH_ROUNDING
  5039.       size = PUSH_ROUNDING (size);
  5040. #endif
  5041.       /* Compute how much space the argument should get:
  5042.      round up to a multiple of the alignment for arguments.  */
  5043.       if (none != FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)), const0_rtx))
  5044.     used = (((size + PARM_BOUNDARY / BITS_PER_UNIT - 1)
  5045.          / (PARM_BOUNDARY / BITS_PER_UNIT))
  5046.         * (PARM_BOUNDARY / BITS_PER_UNIT));
  5047.  
  5048.       tem = arg->value;
  5049.       if (tem == 0)
  5050.     {
  5051.       tem = expand_expr (pval, 0, VOIDmode, 0);
  5052.       /* ANSI doesn't require a sequence point here,
  5053.          but PCC has one, so this will avoid some problems.  */
  5054.       emit_queue ();
  5055.     }
  5056.  
  5057.       /* Don't allow anything left on stack from computation
  5058.      of argument to alloca.  */
  5059.       if (may_be_alloca)
  5060.     do_pending_stack_adjust ();
  5061.  
  5062.       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), 0, 0,
  5063.               arg->partial, arg->reg, used - size,
  5064.               argblock, ARGS_SIZE_RTX (arg->offset));
  5065.     }
  5066.   else if (arg->stack != 0)
  5067.     {
  5068.       /* BLKmode parm, not entirely passed in registers,
  5069.      and with space already allocated.  */
  5070.  
  5071.       tree sizetree = size_in_bytes (TREE_TYPE (pval));
  5072.  
  5073.       /* Find out if the parm needs padding, and whether above or below.  */
  5074.       enum direction where_pad
  5075.     = FUNCTION_ARG_PADDING (TYPE_MODE (TREE_TYPE (pval)),
  5076.                 expand_expr (sizetree, 0, VOIDmode, 0));
  5077.  
  5078.       /* If it is padded below, adjust the stack address
  5079.      upward over the padding.  */
  5080.  
  5081.       if (where_pad == downward)
  5082.     {
  5083.       rtx offset_rtx;
  5084.       rtx address = XEXP (arg->stack, 0);
  5085.       struct args_size stack_offset;
  5086.       /* Hack for C++: see assign_parms for symmetric code.  */
  5087.       int extra = 0;
  5088.  
  5089.       stack_offset.constant = 0;
  5090.       stack_offset.var = 0;
  5091.  
  5092.       if (TREE_INT_CST_LOW (sizetree) * BITS_PER_UNIT != PARM_BOUNDARY)
  5093.         {
  5094.           /* Round the size up to multiple of PARM_BOUNDARY bits.  */
  5095.           tree s1 = convert_units (sizetree, BITS_PER_UNIT, PARM_BOUNDARY);
  5096.           tree s2 = convert_units (s1, PARM_BOUNDARY, BITS_PER_UNIT);
  5097.           /* Compute amount of padding.  */
  5098.           ADD_PARM_SIZE (stack_offset, s2);
  5099.           SUB_PARM_SIZE (stack_offset, sizetree);
  5100.           extra = stack_offset.constant % UNITS_PER_WORD;
  5101.           stack_offset.constant -= extra;
  5102.         }
  5103.       offset_rtx = ARGS_SIZE_RTX (stack_offset);
  5104.  
  5105.       /* If there is rounding to do for a BLKmode parameter,
  5106.          add it in here, since STACK_OFFSET is not used for the
  5107.          rest of this iteration.  */
  5108.       stack_offset.constant += extra;
  5109.  
  5110.       /* Adjust the address to store at.  */
  5111.       if (GET_CODE (offset_rtx) == CONST_INT)
  5112.         address = plus_constant (address, INTVAL (offset_rtx));
  5113.       else
  5114.         {
  5115.           address = gen_rtx (PLUS, Pmode, address, offset_rtx);
  5116.           address = memory_address (QImode, address);
  5117.         }
  5118.       arg->stack = change_address (arg->stack, VOIDmode, address);
  5119.     }
  5120.  
  5121.       /* ARG->stack probably refers to the stack-pointer.  If so,
  5122.      stabilize it, in case stack-pointer changes during evaluation.  */
  5123.       if (reg_mentioned_p (stack_pointer_rtx, arg->stack))
  5124.     arg->stack = change_address (arg->stack, VOIDmode,
  5125.                      copy_to_reg (XEXP (arg->stack, 0)));
  5126.       /* BLKmode argument that should go in a prespecified stack location.  */
  5127.       if (arg->value == 0)
  5128.     /* Not yet computed => compute it there.  */
  5129.     /* ??? This should be changed to tell expand_expr
  5130.        that it can store directly in the target.  */
  5131.     arg->value = store_expr (arg->tree_value, arg->stack, 0);
  5132.       else if (arg->value != arg->stack)
  5133.     /* It was computed somewhere, but not where we wanted.
  5134.        For example, the value may have come from an official
  5135.        local variable or parameter.  In that case, expand_expr
  5136.        does not fill our suggested target.  */
  5137.     emit_block_move (arg->stack, arg->value, ARGS_SIZE_RTX (arg->size),
  5138.              TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT);
  5139.  
  5140.       /* Now, if this value wanted to be partly in registers,
  5141.      move the value from the stack to the registers
  5142.      that are supposed to hold the values.  */
  5143.       if (arg->partial > 0)
  5144.     move_block_to_reg (REGNO (arg->reg), arg->stack, arg->partial);
  5145.     }
  5146.   else
  5147.     {
  5148.       /* BLKmode, at least partly to be pushed.  */
  5149.  
  5150.       register rtx tem
  5151.     = arg->value ? arg->value : expand_expr (pval, 0, VOIDmode, 0);
  5152.       register int excess;
  5153.       rtx size_rtx;
  5154.  
  5155.       /* Pushing a nonscalar.
  5156.      If part is passed in registers, arg->partial says how much
  5157.      and emit_push_insn will take care of putting it there.  */
  5158.  
  5159.       /* Round its size up to a multiple
  5160.      of the allocation unit for arguments.  */
  5161.  
  5162.       if (arg->size.var != 0)
  5163.     {
  5164.       excess = 0;
  5165.       size_rtx = ARGS_SIZE_RTX (arg->size);
  5166.     }
  5167.       else
  5168.     {
  5169.       register tree size = size_in_bytes (TREE_TYPE (pval));
  5170.       /* PUSH_ROUNDING has no effect on us, because
  5171.          emit_push_insn for BLKmode is careful to avoid it.  */
  5172.       excess = (arg->size.constant - TREE_INT_CST_LOW (size)
  5173.             + arg->partial * UNITS_PER_WORD);
  5174.       size_rtx = expand_expr (size, 0, VOIDmode, 0);
  5175.     }
  5176.  
  5177.       /* if (arg->stack) */
  5178.       /*   abort ();     */
  5179.  
  5180.       emit_push_insn (tem, TYPE_MODE (TREE_TYPE (pval)), size_rtx,
  5181.               TYPE_ALIGN (TREE_TYPE (pval)) / BITS_PER_UNIT,
  5182.               arg->partial, arg->reg, excess, argblock,
  5183.               ARGS_SIZE_RTX (arg->offset));
  5184.     }
  5185.  
  5186.   /* Once we have pushed something, pops can't safely
  5187.      be deferred during the rest of the arguments.  */
  5188.   NO_DEFER_POP;
  5189. }
  5190.  
  5191. /* Expand conditional expressions.  */
  5192.  
  5193. /* Generate code to evaluate EXP and jump to LABEL if the value is zero.
  5194.    LABEL is an rtx of code CODE_LABEL, in this function and all the
  5195.    functions here.  */
  5196.  
  5197. void
  5198. jumpifnot (exp, label)
  5199.      tree exp;
  5200.      rtx label;
  5201. {
  5202.   do_jump (exp, label, 0);
  5203. }
  5204.  
  5205. /* Generate code to evaluate EXP and jump to LABEL if the value is nonzero.  */
  5206.  
  5207. void
  5208. jumpif (exp, label)
  5209.      tree exp;
  5210.      rtx label;
  5211. {
  5212.   do_jump (exp, 0, label);
  5213. }
  5214.  
  5215. /* Generate code to evaluate EXP and jump to IF_FALSE_LABEL if
  5216.    the result is zero, or IF_TRUE_LABEL if the result is one.
  5217.    Either of IF_FALSE_LABEL and IF_TRUE_LABEL may be zero,
  5218.    meaning fall through in that case.
  5219.  
  5220.    This function is responsible for optimizing cases such as
  5221.    &&, || and comparison operators in EXP.  */
  5222.  
  5223. void
  5224. do_jump (exp, if_false_label, if_true_label)
  5225.      tree exp;
  5226.      rtx if_false_label, if_true_label;
  5227. {
  5228.   register enum tree_code code = TREE_CODE (exp);
  5229.   /* Some cases need to create a label to jump to
  5230.      in order to properly fall through.
  5231.      These cases set DROP_THROUGH_LABEL nonzero.  */
  5232.   rtx drop_through_label = 0;
  5233.   rtx temp;
  5234.   rtx comparison = 0;
  5235.  
  5236.   emit_queue ();
  5237.  
  5238.   switch (code)
  5239.     {
  5240.     case ERROR_MARK:
  5241.       break;
  5242.  
  5243.     case INTEGER_CST:
  5244.       temp = integer_zerop (exp) ? if_false_label : if_true_label;
  5245.       if (temp)
  5246.     emit_jump (temp);
  5247.       break;
  5248.  
  5249.     case ADDR_EXPR:
  5250.       /* The address of something can never be zero.  */
  5251.       if (if_true_label)
  5252.     emit_jump (if_true_label);
  5253.       break;
  5254.  
  5255.     case NOP_EXPR:
  5256.       do_jump (TREE_OPERAND (exp, 0), if_false_label, if_true_label);
  5257.       break;
  5258.  
  5259.     case TRUTH_NOT_EXPR:
  5260.       do_jump (TREE_OPERAND (exp, 0), if_true_label, if_false_label);
  5261.       break;
  5262.  
  5263.     case TRUTH_ANDIF_EXPR:
  5264.       if (if_false_label == 0)
  5265.     if_false_label = drop_through_label = gen_label_rtx ();
  5266.       do_jump (TREE_OPERAND (exp, 0), if_false_label, 0);
  5267.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5268.       break;
  5269.  
  5270.     case TRUTH_ORIF_EXPR:
  5271.       if (if_true_label == 0)
  5272.     if_true_label = drop_through_label = gen_label_rtx ();
  5273.       do_jump (TREE_OPERAND (exp, 0), 0, if_true_label);
  5274.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5275.       break;
  5276.  
  5277.     case COMPOUND_EXPR:
  5278.       expand_expr (TREE_OPERAND (exp, 0), const0_rtx, VOIDmode, 0);
  5279.       emit_queue ();
  5280.       do_jump (TREE_OPERAND (exp, 1), if_false_label, if_true_label);
  5281.       break;
  5282.  
  5283.     case COND_EXPR:
  5284.       {
  5285.     register rtx label1 = gen_label_rtx ();
  5286.     drop_through_label = gen_label_rtx ();
  5287.     do_jump (TREE_OPERAND (exp, 0), label1, 0);
  5288.     /* Now the THEN-expression.  */
  5289.     do_jump (TREE_OPERAND (exp, 1),
  5290.          if_false_label ? if_false_label : drop_through_label,
  5291.          if_true_label ? if_true_label : drop_through_label);
  5292.     emit_label (label1);
  5293.     /* Now the ELSE-expression.  */
  5294.     do_jump (TREE_OPERAND (exp, 2),
  5295.          if_false_label ? if_false_label : drop_through_label,
  5296.          if_true_label ? if_true_label : drop_through_label);
  5297.       }
  5298.       break;
  5299.  
  5300.     case EQ_EXPR:
  5301.       comparison = compare (exp, EQ, EQ, EQ, EQ);
  5302.       break;
  5303.  
  5304.     case NE_EXPR:
  5305.       comparison = compare (exp, NE, NE, NE, NE);
  5306.       break;
  5307.  
  5308.     case LT_EXPR:
  5309.       comparison = compare (exp, LT, LTU, GT, GTU);
  5310.       break;
  5311.  
  5312.     case LE_EXPR:
  5313.       comparison = compare (exp, LE, LEU, GE, GEU);
  5314.       break;
  5315.  
  5316.     case GT_EXPR:
  5317.       comparison = compare (exp, GT, GTU, LT, LTU);
  5318.       break;
  5319.  
  5320.     case GE_EXPR:
  5321.       comparison = compare (exp, GE, GEU, LE, LEU);
  5322.       break;
  5323.  
  5324.     default:
  5325.       temp = expand_expr (exp, 0, VOIDmode, 0);
  5326.       /* Copy to register to avoid generating bad insns by cse
  5327.      from (set (mem ...) (arithop))  (set (cc0) (mem ...)).  */
  5328.       if (!cse_not_expected && GET_CODE (temp) == MEM)
  5329.     temp = copy_to_reg (temp);
  5330.       do_pending_stack_adjust ();
  5331.       {
  5332.     rtx zero = CONST0_RTX (GET_MODE (temp));
  5333.  
  5334.     if (GET_CODE (temp) == CONST_INT)
  5335.       comparison = compare_constants (NE, 0,
  5336.                       INTVAL (temp), 0, BITS_PER_WORD);
  5337.     else if (GET_MODE (temp) != VOIDmode)
  5338.       comparison = compare1 (temp, zero, NE, NE, 0, GET_MODE (temp));
  5339.     else
  5340.       abort ();
  5341.       }
  5342.     }
  5343.  
  5344.   /* Do any postincrements in the expression that was tested.  */
  5345.   emit_queue ();
  5346.  
  5347.   /* If COMPARISON is nonzero here, it is an rtx that can be substituted
  5348.      straight into a conditional jump instruction as the jump condition.
  5349.      Otherwise, all the work has been done already.  */
  5350.  
  5351.   if (comparison == const1_rtx)
  5352.     {
  5353.       if (if_true_label)
  5354.     emit_jump (if_true_label);
  5355.     }
  5356.   else if (comparison == const0_rtx)
  5357.     {
  5358.       if (if_false_label)
  5359.     emit_jump (if_false_label);
  5360.     }
  5361.   else if (comparison)
  5362.     {
  5363.       if (if_true_label)
  5364.     {
  5365.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] != 0)
  5366.         emit_jump_insn ((*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_true_label));
  5367.       else
  5368.         abort ();
  5369.  
  5370.       if (if_false_label)
  5371.         emit_jump (if_false_label);
  5372.     }
  5373.       else if (if_false_label)
  5374.     {
  5375.       rtx pat;
  5376.  
  5377.       if (bcc_gen_fctn[(int) GET_CODE (comparison)] == 0)
  5378.         abort ();
  5379.  
  5380.       pat = (*bcc_gen_fctn[(int) GET_CODE (comparison)]) (if_false_label);
  5381.       /* Now invert the sense of the jump by exchanging the two arms
  5382.          of each IF_THEN_ELSE.  Note that inverting the condition
  5383.          would be incorrect for IEEE floating point with nans!  */
  5384.       if (GET_CODE (pat) == SEQUENCE)
  5385.         {
  5386.           int i;
  5387.           /* We can invert a sequence if the only jump is at the end.  */
  5388.           for (i = 0; i < (int) (XVECLEN (pat, 0) - 1); i++)
  5389.         if (GET_CODE (XVECEXP (pat, 0, i)) == JUMP_INSN)
  5390.           abort ();
  5391.           invert_exp (PATTERN (XVECEXP (pat, 0, XVECLEN (pat, 0) - 1)),
  5392.               0, 0);
  5393.         }
  5394.       else
  5395.         invert_exp (pat, 0, 0);
  5396.  
  5397.       emit_jump_insn (pat);
  5398.     }
  5399.     }
  5400.  
  5401.   if (drop_through_label)
  5402.     emit_label (drop_through_label);
  5403. }
  5404.  
  5405. /* Compare two integer constant rtx's, OP0 and OP1.
  5406.    The comparison operation is OPERATION.
  5407.    Return an rtx representing the value 1 or 0.
  5408.    WIDTH is the width in bits that is significant.  */
  5409.  
  5410. static rtx
  5411. compare_constants (operation, unsignedp, op0, op1, width)
  5412.      enum rtx_code operation;
  5413.      int unsignedp;
  5414.      int op0, op1;
  5415.      int width;
  5416. {
  5417.   int val;
  5418.  
  5419.   /* Sign-extend or zero-extend the operands to a full word
  5420.      from an initial width of WIDTH bits.  */
  5421.   if (width < HOST_BITS_PER_INT)
  5422.     {
  5423.       op0 &= (1 << width) - 1;
  5424.       op1 &= (1 << width) - 1;
  5425.  
  5426.       if (! unsignedp)
  5427.     {
  5428.       if (op0 & (1 << (width - 1)))
  5429.         op0 |= ((-1) << width);
  5430.       if (op1 & (1 << (width - 1)))
  5431.         op1 |= ((-1) << width);
  5432.     }
  5433.     }
  5434.  
  5435.   switch (operation)
  5436.     {
  5437.     case EQ:
  5438.       val = op0 == op1;
  5439.       break;
  5440.  
  5441.     case NE:
  5442.       val = op0 != op1;
  5443.       break;
  5444.  
  5445.     case GT:
  5446.     case GTU:
  5447.       val = op0 > op1;
  5448.       break;
  5449.  
  5450.     case LT:
  5451.     case LTU:
  5452.       val = op0 < op1;
  5453.       break;
  5454.  
  5455.     case GE:
  5456.     case GEU:
  5457.       val = op0 >= op1;
  5458.       break;
  5459.  
  5460.     case LE:
  5461.     case LEU:
  5462.       val = op0 <= op1;
  5463.     }
  5464.  
  5465.   return val ? const1_rtx : const0_rtx;
  5466. }
  5467.  
  5468. /* Generate code for a comparison expression EXP
  5469.    (including code to compute the values to be compared)
  5470.    and set (CC0) according to the result.
  5471.    SIGNED_FORWARD should be the rtx operation for this comparison for
  5472.    signed data; UNSIGNED_FORWARD, likewise for use if data is unsigned.
  5473.    SIGNED_REVERSE and UNSIGNED_REVERSE are used if it is desirable
  5474.    to interchange the operands for the compare instruction.
  5475.  
  5476.    We force a stack adjustment unless there are currently
  5477.    things pushed on the stack that aren't yet used.  */
  5478.  
  5479. static rtx
  5480. compare (exp, signed_forward, unsigned_forward,
  5481.      signed_reverse, unsigned_reverse)
  5482.      register tree exp;
  5483.      enum rtx_code signed_forward, unsigned_forward;
  5484.      enum rtx_code signed_reverse, unsigned_reverse;
  5485. {
  5486.  
  5487.   register rtx op0 = expand_expr (TREE_OPERAND (exp, 0), 0, VOIDmode, 0);
  5488.   register rtx op1 = expand_expr (TREE_OPERAND (exp, 1), 0, VOIDmode, 0);
  5489.   register enum machine_mode mode = GET_MODE (op0);
  5490.   int unsignedp;
  5491.  
  5492.   /* If one operand is 0, make it the second one.  */
  5493.  
  5494.   if (op0 == const0_rtx
  5495.       || (GET_MODE_CLASS (mode) == MODE_FLOAT && op0 == CONST0_RTX (mode)))
  5496.     {
  5497.       rtx tem = op0;
  5498.       op0 = op1;
  5499.       op1 = tem;
  5500.       signed_forward = signed_reverse;
  5501.       unsigned_forward = unsigned_reverse;
  5502.     }
  5503.  
  5504.   if (flag_force_mem)
  5505.     {
  5506.       op0 = force_not_mem (op0);
  5507.       op1 = force_not_mem (op1);
  5508.     }
  5509.  
  5510.   do_pending_stack_adjust ();
  5511.  
  5512.   unsignedp = (TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 0)))
  5513.            || TREE_UNSIGNED (TREE_TYPE (TREE_OPERAND (exp, 1))));
  5514.  
  5515.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  5516.     return compare_constants (signed_forward, unsignedp,
  5517.                   INTVAL (op0), INTVAL (op1),
  5518.                   GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_OPERAND (exp, 0)))));
  5519.  
  5520.   emit_cmp_insn (op0, op1,
  5521.          (mode == BLKmode) ? expr_size (TREE_OPERAND (exp, 0)) : 0,
  5522.          unsignedp,
  5523.          TYPE_ALIGN (TREE_TYPE (exp)) / BITS_PER_UNIT);
  5524.  
  5525.   return gen_rtx ((unsignedp ? unsigned_forward : signed_forward),
  5526.           VOIDmode, cc0_rtx, const0_rtx);
  5527. }
  5528.  
  5529. /* Like compare but expects the values to compare as two rtx's.
  5530.    The decision as to signed or unsigned comparison must be made by the caller.
  5531.    BLKmode is not allowed.  */
  5532.  
  5533. static rtx
  5534. compare1 (op0, op1, forward_op, reverse_op, unsignedp, mode)
  5535.      register rtx op0, op1;
  5536.      enum rtx_code forward_op, reverse_op;
  5537.      int unsignedp;
  5538.      enum machine_mode mode;
  5539. {
  5540.   /* If one operand is 0, make it the second one.  */
  5541.  
  5542.   if (op0 == const0_rtx
  5543.       || (GET_MODE_CLASS (mode) == MODE_FLOAT && op0 == CONST0_RTX (mode)))
  5544.     {
  5545.       rtx tem = op0;
  5546.       op0 = op1;
  5547.       op1 = tem;
  5548.       forward_op = reverse_op;
  5549.     }
  5550.  
  5551.   if (flag_force_mem)
  5552.     {
  5553.       op0 = force_not_mem (op0);
  5554.       op1 = force_not_mem (op1);
  5555.     }
  5556.  
  5557.   do_pending_stack_adjust ();
  5558.  
  5559.   if (GET_CODE (op0) == CONST_INT && GET_CODE (op1) == CONST_INT)
  5560.     return compare_constants (forward_op, unsignedp,
  5561.                   INTVAL (op0), INTVAL (op1),
  5562.                   GET_MODE_BITSIZE (mode));
  5563.  
  5564.   emit_cmp_insn (op0, op1, 0, unsignedp, 0);
  5565.  
  5566.   return gen_rtx (forward_op, VOIDmode, cc0_rtx, const0_rtx);
  5567. }
  5568.  
  5569. /* Generate code to calculate EXP using a store-flag instruction
  5570.    and return an rtx for the result.
  5571.    If TARGET is nonzero, store the result there if convenient.
  5572.  
  5573.    Return zero if there is no suitable set-flag instruction
  5574.    available on this machine.  */
  5575.  
  5576. static rtx
  5577. do_store_flag (exp, target, mode)
  5578.      tree exp;
  5579.      rtx target;
  5580.      enum machine_mode mode;
  5581. {
  5582.   register enum tree_code code = TREE_CODE (exp);
  5583.   register rtx comparison = 0;
  5584.   enum machine_mode compare_mode;
  5585.   rtx prev_insn = get_last_insn ();
  5586.   enum insn_code icode;
  5587.  
  5588.   switch (code)
  5589.     {
  5590. #ifdef HAVE_seq
  5591.     case EQ_EXPR:
  5592.       if (HAVE_seq)
  5593.     {
  5594.       comparison = compare (exp, EQ, EQ, EQ, EQ);
  5595.       icode = CODE_FOR_seq;
  5596.       compare_mode = insn_operand_mode[(int) CODE_FOR_seq][0];
  5597.     }
  5598.       break;
  5599. #endif
  5600.  
  5601. #ifdef HAVE_sne
  5602.     case NE_EXPR:
  5603.       if (HAVE_sne)
  5604.     {
  5605.       comparison = compare (exp, NE, NE, NE, NE);
  5606.       icode = CODE_FOR_sne;
  5607.       compare_mode = insn_operand_mode[(int) CODE_FOR_sne][0];
  5608.     }
  5609.       break;
  5610. #endif
  5611.  
  5612. #if defined (HAVE_slt) && defined (HAVE_sltu) && defined (HAVE_sgt) && defined (HAVE_sgtu)
  5613.     case LT_EXPR:
  5614.       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
  5615.     {
  5616.       comparison = compare (exp, LT, LTU, GT, GTU);
  5617.       icode = CODE_FOR_slt;
  5618.       compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
  5619.     }
  5620.       break;
  5621.  
  5622.     case GT_EXPR:
  5623.       if (HAVE_slt && HAVE_sltu && HAVE_sgt && HAVE_sgtu)
  5624.     {
  5625.       comparison = compare (exp, GT, GTU, LT, LTU);
  5626.       icode = CODE_FOR_slt;
  5627.       compare_mode = insn_operand_mode[(int) CODE_FOR_slt][0];
  5628.     }
  5629.       break;
  5630. #endif
  5631.  
  5632. #if defined (HAVE_sle) && defined (HAVE_sleu) && defined (HAVE_sge) && defined (HAVE_sgeu)
  5633.     case LE_EXPR:
  5634.       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
  5635.     {
  5636.       comparison = compare (exp, LE, LEU, GE, GEU);
  5637.       icode = CODE_FOR_sle;
  5638.       compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
  5639.     }
  5640.       break;
  5641.  
  5642.     case GE_EXPR:
  5643.       if (HAVE_sle && HAVE_sleu && HAVE_sge && HAVE_sgeu)
  5644.     {
  5645.       comparison = compare (exp, GE, GEU, LE, LEU);
  5646.       icode = CODE_FOR_sle;
  5647.       compare_mode = insn_operand_mode[(int) CODE_FOR_sle][0];
  5648.     }
  5649.       break;
  5650. #endif
  5651.     }
  5652.   if (comparison == 0)
  5653.     return 0;
  5654.  
  5655.   if (target == 0 || GET_MODE (target) != mode
  5656.       /* Don't use specified target unless the insn can handle it.  */
  5657.       || ! (*insn_operand_predicate[(int) icode][0]) (target, mode)
  5658.       /* When modes don't match, don't use specified target,
  5659.      because it might be the same as an operand,
  5660.      and then the CLOBBER output below would screw up.  */
  5661.       || (mode != compare_mode && GET_CODE (comparison) != CONST_INT))
  5662.     target = gen_reg_rtx (mode);
  5663.  
  5664.   /* Store the comparison in its proper mode.  */
  5665.   if (GET_CODE (comparison) == CONST_INT)
  5666.     emit_move_insn (target, comparison);
  5667.   else if (GET_MODE (target) != compare_mode)
  5668.     {
  5669.       /* We want a different mode: store result in its natural mode.
  5670.      Combine the mode conversion with the truncation we must do anyway.  */
  5671.       /* Put a CLOBBER before the compare, so we don't come between
  5672.      the compare and the insn that uses the result.  */
  5673.       emit_insn_after (gen_rtx (CLOBBER, VOIDmode, target), prev_insn);
  5674.       emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)])
  5675.          (gen_rtx (SUBREG, compare_mode, target, 0)));
  5676.       /* If the desired mode is wider than what we got,
  5677.      use an AND to convert it, but not if we will do one anyway.  */
  5678. #if STORE_FLAG_VALUE == 1
  5679.       if (GET_MODE_SIZE (mode) > GET_MODE_SIZE (compare_mode))
  5680.     expand_bit_and (mode, target, const1_rtx, target);
  5681. #endif
  5682.     }
  5683.   else
  5684.     emit_insn ((*setcc_gen_fctn[(int) GET_CODE (comparison)]) (target));
  5685.  
  5686. #if STORE_FLAG_VALUE != 1
  5687. #if STORE_FLAG_VALUE & 1
  5688.   expand_bit_and (mode, target, const1_rtx, target);
  5689. #else
  5690.   expand_shift (RSHIFT_EXPR, mode, target,
  5691.         build_int_2 (GET_MODE_BITSIZE (mode) - 1, 0),
  5692.         target, TRUE);
  5693. #endif
  5694. #endif
  5695.   return target;
  5696. }
  5697.  
  5698. /* Generate a tablejump instruction (used for switch statements).  */
  5699.  
  5700. #ifdef HAVE_tablejump
  5701.  
  5702. /* INDEX is the value being switched on, with the lowest value
  5703.    in the table already subtracted.
  5704.    RANGE is the length of the jump table.
  5705.    TABLE_LABEL is a CODE_LABEL rtx for the table itself.
  5706.  
  5707.    DEFAULT_LABEL is a CODE_LABEL rtx to jump to if the
  5708.    index value is out of range.  */
  5709.  
  5710. void
  5711. do_tablejump (index, range, table_label, default_label)
  5712.      rtx index, range, table_label, default_label;
  5713. {
  5714.   register rtx temp;
  5715.  
  5716.   emit_cmp_insn (range, index, 0, 0, 0);
  5717.   emit_jump_insn (gen_bltu (default_label));
  5718.   /* If flag_force_addr were to affect this address
  5719.      it could interfere with the tricky assumptions made
  5720.      about addresses that contain label-refs,
  5721.      which may be valid only very near the tablejump itself.  */
  5722.   index = memory_address_noforce
  5723.     (CASE_VECTOR_MODE,
  5724.      gen_rtx (PLUS, Pmode,
  5725.           gen_rtx (MULT, Pmode, index,
  5726.                gen_rtx (CONST_INT, VOIDmode,
  5727.                 GET_MODE_SIZE (CASE_VECTOR_MODE))),
  5728.           gen_rtx (LABEL_REF, VOIDmode, table_label)));
  5729.   temp = gen_reg_rtx (CASE_VECTOR_MODE);
  5730.   convert_move (temp, gen_rtx (MEM, CASE_VECTOR_MODE, index), 0);
  5731.  
  5732.   emit_jump_insn (gen_tablejump (temp, table_label));
  5733. }
  5734.  
  5735. #endif /* HAVE_tablejump */
  5736.